import AppSettings from "@runtime/base/AppSettings";
import { ClientMessage } from "@runtime/generate/message/ClientMessage";
import DeviceComponent from "@runtime/module/Device/DeviceComponent";
import ModalComponent, { ModalOptions } from "@runtime/module/Modal/ModalComponent";
import RouterComponent from "@runtime/module/Router/RouterComponent";
import TimerComponent from "@runtime/module/Timer/TimerComponent";
import WebSocketComponent from "@runtime/module/WebSocket/WebSocketComponent";
import WebWindowComponent from "@runtime/module/WebWindow/WebWindowComponent";
import AnimatorComponent from "@runtime/UnityEngineBridge/AnimatorComponent";
import AssetLoaderComponent from "@runtime/UnityEngineBridge/AssetLoaderComponent";
import GameObjectComponent from "@runtime/UnityEngineBridge/GameObjectComponent";
import HighlighterComponent from "@runtime/UnityEngineBridge/HighlighterComponent";
import InteractableObjectComponent from "@runtime/UnityEngineBridge/InteractableObjectComponent";
import LabelComponent from "@runtime/UnityEngineBridge/LabelComponent";
import PostProcessLayerComponent from "@runtime/UnityEngineBridge/PostProcessLayerComponent";
import TooltipComponent from "@runtime/UnityEngineBridge/TooltipComponent";
import { computed, ComputedRef, reactive, ref, Ref, UnwrapNestedRefs, watch, WatchStopHandle } from "vue";
import MMWRSettings from "./MMWRSettings";
import OrbitCameraComponent from "./OrbitCameraComponent";
import RoomComponent from "./RoomComponent";
import UsageCameraComponent from "./UsageCameraComponent";
import { useRouter } from "vue-router";


function ToMap<TKey, TValue>(sources: Array<TValue>, keySelector: (element: TValue) => TKey): Map<TKey, TValue> {
    const map = new Map<TKey, TValue>();
    for (const element of sources) {
        map.set(keySelector(element), element);
    }
    return map;
}

export const ModuleConfigs: ComputedRef<Array<{ Id: number, Name: string, Description: string, Icon: string }>> = computed(() => {
    const configs = [
        { Id: 1, Name: 'Introduction', Description: '系统简介', Icon: 'ic_menu_1' },
        { Id: 2, Name: 'Structure', Description: '结构认知', Icon: 'ic_menu_2' },
        { Id: 3, Name: 'Principle', Description: '工作原理', Icon: 'ic_menu_3' },
        { Id: 4, Name: 'Install', Description: '安装', Icon: 'ic_menu_4' },
        { Id: 5, Name: 'Calibration', Description: '标定', Icon: 'ic_menu_5' },
        { Id: 6, Name: 'Protocol', Description: '协议解读', Icon: 'ic_menu_6' },
    ];

    // if (MMWRComponent.Default.Status.value == '设备已连接') {
        if (MMWRComponent.Default.Status.value == '设备连接成功') {
        configs.add({ Id: 7, Name: 'Usage', Description: '应用', Icon: 'ic_menu_7' },);
    }

    return configs;
});

class CoroutineLock implements Chaos.IDisposable {
    public Type: number = 0;
    public Key: number = 0;
    public Count: number = 0;

    private isCompleted: boolean = false;
    private task?: (value: void | PromiseLike<void>) => void;

    constructor(type: number, key: number, count: number) {
        this.Type = type;
        this.Key = key;
        this.Count = count;
    }

    async WaitAsync(): Promise<void> {
        if (this.isCompleted) {
            return;
        }

        return new Promise(resolve => this.task = resolve);
    }

    Dispose() {
        MMWRComponent.Default.IsLoading.value = false;

        this.Type = 0;
        this.Key = 0;
        this.Count = 0;

        if (this.task != undefined) {
            this.task();
        }

        this.isCompleted = true;
    }
}

/**
 * 毫米波雷达组件
 */
export default class MMWRComponent {
    private static instance: MMWRComponent = new MMWRComponent();
    /**
     * 毫米波雷达组件
     */
    public showTip: Ref<boolean> = ref(false);

    public static get Default(): MMWRComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.Status, this.OnDeviceUpdatedAsync.bind(this)));
        this.watchStopHandles.push(watch(this.Module, this.OnModuleChangedAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    public DeviceId: number = 0;

    public Status: ComputedRef<string> = computed(() => DeviceComponent.Default.Devices.get(this.DeviceId)?.Status ?? '设备连接中');

    public IsLoading: Ref<boolean> = ref(false);

    public Module: Ref<string> = ref('');

    private map: Map<number, Array<CoroutineLock>> = new Map();

    private hasInitialized: boolean = false;

    private watchStopHandles: Array<WatchStopHandle> = [];

    public async Awake(): Promise<void> {
        ModalComponent.Default.AddDynamicModules(import.meta.glob('/src/components/Apps/MMWR/Exit.vue'));
        ModalComponent.Default.AddDynamicModules(import.meta.glob('/src/components/Apps/MMWR/MessageBox.vue'));

        this.Module.value = 'Home';

        // 启动Unity
        const configuration = JSON.stringify({
            LocalAddress: AppSettings.Default.LocalAddress,
            ShortName: 'P10050',
            Type: 4,
        });
        await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.EmbeddedApplicationLaunchRequest('../EmbeddedApplication/Unity/Mix.Unity.exe', configuration));

        // 获取Unity版本状态
        await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.EmbeddedApplicationVersionRequest());

        if (!this.hasInitialized) {
            await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarDeviceInitializationRequest(
                MMWRSettings.Default.DeviceType,
                MMWRSettings.Default.DeviceIndex,
                MMWRSettings.Default.CanIndex,
            ));

            this.hasInitialized = true;
        }

        this.Module.value = 'Introduction';
    }

    public async Destroy(): Promise<void> {
    }

    private async OnDeviceUpdatedAsync(current: string, previous: string): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        const modules = ModuleConfigs.value.map(config => config.Name);
        if (this.Status.value != '设备已连接' && !modules.includes(this.Module.value)) {
            this.Module.value = modules[0];
        }

        lock.Dispose();
    }

    /**
    * 模块发生变化时
    * @param value 模块
    */
    private async OnModuleChangedAsync(value: string): Promise<void> {
        // 切换至指定传感器路由
        const url = `/${AppSettings.Default.Type}/${value}`;
        await RouterComponent.Default.NavigateToAsync(url);
    }

    public async OnExitAsync(): Promise<void> {
        const volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        const effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(volume);

        const options = ModalOptions.Default()
            .WithPrefix('/src/components/Apps/MMWR/')
            .WithType('Exit')
            .WithContent('是否确认退出软件?')
            .WithButtons(['确定', '取消']);
        const result = await ModalComponent.Default.PopupAsync(options);

        if (result == '确定') {
            WebSocketComponent.Default.PostMessage(new ClientMessage.ShutdownMessage());
        }

        await PostProcessLayerComponent.Default.RemoveEffectAsync(volume, effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(volume);
    }

    public async WaitAsync(type: number = 0, key: number = 0): Promise<CoroutineLock> {
        this.IsLoading.value = true;

        if (!this.map.has(key)) {
            this.map.set(key, []);
        }

        const locks = this.map.get(key)!;
        const lock = new CoroutineLock(type, key, locks.length);
        locks.add(lock);
        if (locks.length < 2) {
            return new Promise(resolve => resolve(lock));
        } else {
            const previous = locks[locks.length - 2];
            await previous.WaitAsync();
            return new Promise(resolve => resolve(lock));
        }
    }
}

/**
 * 简介
 */
export class IntroductionComponent {
    private static instance: IntroductionComponent = new IntroductionComponent();
    /**
     * 简介
     */
    public static get Default(): IntroductionComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    public Title: string = '毫米波雷达传感器系统';

    public Description: string =`毫米波雷达传感器工作在毫米波段。通常毫米波是指30 ~ 300GHz频段(波长为1 ~ 10mm)。
    毫米波的波长介于厘米波和光波之间，因此毫米波兼有微波制导和光电制导的优点。
    同厘米波导引头相比，毫米波导引头具有体积小、质量轻和空间分辨率高的特点。
    与红外、激光、电视等光学导引头相比,毫米波导引头穿透雾、烟、灰尘的能力强，具有全天候(大雨天除外)全天时的特点。
    另外,毫米波导引头的抗干扰、反隐身能力也优于其他微波导引头。`;

    public Img: string = '/static/MMWR/简介.png';

    private instanceId: number = 0;

    private watchStopHandles: Array<WatchStopHandle> = [];

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetTransparentBackground();
        TooltipComponent.Default.Clear();

        if (this.instanceId == 0) {
            this.instanceId = await AssetLoaderComponent.Default.LoadAsync('Assets/R00034/ICV/Product/Introduction/毫米波雷达系统/毫米波雷达系统.prefab');
        } else {
            await GameObjectComponent.Default.ShowAsync(this.instanceId);
        }

        await OrbitCameraComponent.Default.UpdateAsync([0, 0.18, -0.18], 90, 20, 3, 0.1, 10);

        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        await GameObjectComponent.Default.HideAsync(this.instanceId);

        lock.Dispose();
    }
}

class StructureOptionConfig {
    Id: number;
    InstanceId: number;
    Type: string;
    Asset: string;
    /**
     * 动画状态
     */
    State: string;
    Description: string;
    ViewId: number;

    constructor(id: number, instanceId: number, type: string, asset: string, state: string, description: string, viewId: number) {
        this.Id = id;
        this.InstanceId = instanceId;
        this.Type = type;
        this.Asset = asset;
        this.State = state;
        this.Description = description;
        this.ViewId = viewId;
    }
}

class StructureConfig {
    Id: number;
    Name: string;
    Options: Array<number>;

    constructor(id: number, name: string, options: Array<number>) {
        this.Id = id;
        this.Name = name;
        this.Options = options;
    }
}

class TreeNode {
    public Id: number;
    public Parent: TreeNode | undefined;
    public Children: Array<TreeNode>;

    public Expand: boolean;

    public get HasChildren(): boolean {
        return this.Children.length != 0;
    }


    public get Indent(): number {
        return (this.Parent?.Indent ?? -1) + 1;
    }


    constructor(id: number, children: Array<TreeNode> = [], expand: boolean = false, parent: TreeNode | undefined = undefined) {
        this.Id = id;
        this.Parent = parent;
        this.Children = children;
        this.Expand = expand;

        for (const child of this.Children) {
            child.Parent = this;
        }
    }
}

/**
 * 结构认知
 */
export class StructureComponent {
    private static instance: StructureComponent = new StructureComponent();
    /**
     * 结构认知
     */
    public static get Default(): StructureComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.Id, this.OnIdChangedAsync.bind(this)));
        this.watchStopHandles.push(watch(this.OptionId, this.OnOptionIdChangedAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    public Node: UnwrapNestedRefs<TreeNode> = reactive(new TreeNode(1, [
        new TreeNode(2,[
            new TreeNode(9),
            new TreeNode(10),
            new TreeNode(11),
            new TreeNode(12),
            new TreeNode(13),
            new TreeNode(14),
            new TreeNode(15),
        ]),
        new TreeNode(3),
        new TreeNode(4),
        new TreeNode(5),
        new TreeNode(6),
        new TreeNode(7),
        new TreeNode(8),
    ], true));

    /**
     * 结构配置
     */
    public Configs: UnwrapNestedRefs<Map<number, StructureConfig>> = reactive(ToMap<number, StructureConfig>([
        new StructureConfig(1, '毫米波雷达系统', [1, 2]),
        new StructureConfig(2, '毫米波雷达', [3, 4]),

        new StructureConfig(9, '压铸底板', [15]),
        new StructureConfig(10, '压铸底板密封圈', [16]),
        new StructureConfig(11, '单片微波集成电路板', [17]),
        new StructureConfig(12, '毫米波雷达处理器壳体', [18]),
        new StructureConfig(13, '毫米波雷达PCB板', [19]),
        new StructureConfig(14, '雷达处理器密封圈', [20]),
        new StructureConfig(15, '雷达整流罩', [21]),

        new StructureConfig(3, 'CAN卡', [5, 6]),
        new StructureConfig(4, '计算平台', [7, 8]),
        new StructureConfig(5, '毫米波雷达线束', [9, 10]),
        new StructureConfig(6, 'CAN转USB数据线', [11, 12]),
        new StructureConfig(7, '毫米波雷达电源', [13]),
        new StructureConfig(8, '计算机平台电源', [14]),
    ], element => element.Id));

    public Options: UnwrapNestedRefs<Map<number, StructureOptionConfig>> = reactive(ToMap<number, StructureOptionConfig>([
        new StructureOptionConfig(1, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达系统.prefab', '', '', 2001),
        new StructureOptionConfig(2, 0, '组成', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达系统.prefab', '', '', 2002),

        new StructureOptionConfig(3, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达.prefab', '', '', 2003),
        new StructureOptionConfig(4, 0, '组成', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达.prefab', 'Default', '', 2004),

        new StructureOptionConfig(5, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/CAN卡.prefab', '', '', 2005),
        new StructureOptionConfig(6, 0, '组成', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/CAN卡.prefab', '', '', 2006),

        new StructureOptionConfig(7, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/计算平台.prefab', '', '', 2007),
        new StructureOptionConfig(8, 0, '组成', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/计算平台.prefab', '', '', 2008),

        new StructureOptionConfig(9, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达线束.prefab', '', '', 2009),
        new StructureOptionConfig(10, 0, '组成', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达线束.prefab', '', '', 2010),

        new StructureOptionConfig(11, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/CAN转USB数据线.prefab', '', '', 2011),
        new StructureOptionConfig(12, 0, '组成', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/CAN转USB数据线.prefab', '', '', 2012),

        new StructureOptionConfig(13, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达电源.prefab', '', '', 2013),

        new StructureOptionConfig(14, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/计算机平台电源.prefab', '', '', 2014),
        
        new StructureOptionConfig(15, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/压铸底板.prefab', '', '', 2031),
        
        new StructureOptionConfig(16, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/压铸底板密封圈.prefab', '', '', 2032),
        
        new StructureOptionConfig(17, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/单片微波集成电路板.prefab', '', '', 2015),
                
        new StructureOptionConfig(18, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达处理器壳体.prefab', '', '', 2033),
        
        new StructureOptionConfig(19, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/毫米波雷达PCB板.prefab', '', '', 2016),
        
        new StructureOptionConfig(20, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/雷达处理器密封圈.prefab', '', '', 2034),
        
        new StructureOptionConfig(21, 0, '结构', 'Assets/R00034/ICV/Product/Structure/毫米波雷达系统/雷达整流罩.prefab', '', '', 2035),
    ], element => element.Id));

    /**
     * 当前结构配置Id
     */
    public Id: Ref<number> = ref(1);

    /**
     * 当前结构配置选项Id
     */
    public OptionId: Ref<number> = ref(1);

    /**
     * 当前结构配置
     */
    public Config: ComputedRef<StructureConfig> = computed(() => this.Configs.get(this.Id.value)!);

    /**
     * 当前结构配置
     */
    public Option: ComputedRef<StructureOptionConfig> = computed(() => this.Options.get(this.OptionId.value)!);

    public FilterOptions: ComputedRef<Array<StructureOptionConfig>> = computed(() => Array.from(this.Options.values()).filter(config => this.Config.value.Options.includes(config.Id)));

    /**
     * 当前选项对应文本描述
     */
    public Description: ComputedRef<string> = computed(() => this.Options.get(this.OptionId.value)?.Description ?? '');
    public DescriptionAudioAccessibility: Ref<boolean> = ref(true);
    public AudioStats = reactive({ pausable: false });

    private hasInitialized: boolean = false;
    private watchStopHandles: Array<WatchStopHandle> = [];

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetTransparentBackground();
        TooltipComponent.Default.Clear();

        if (!this.hasInitialized) {
            await this.LoadAsync();
            this.hasInitialized = true;
        } 
        // else {
        //     await GameObjectComponent.Default.ShowAsync(this.Option.value.InstanceId);
        // }
        await GameObjectComponent.Default.ShowAsync(this.Option.value.InstanceId);
        await OrbitCameraComponent.Default.ApplyConfigAsync(this.Option.value.ViewId);
        if (this.Option.value.Type == '组成') {
            // 加载标签
            await LabelComponent.Default.LoadAsync(this.Option.value.InstanceId);
        }

        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        LabelComponent.Default.Clear();
        await HighlighterComponent.Default.ClearAsync();

        await GameObjectComponent.Default.HideAsync(this.Option.value.InstanceId);

        lock.Dispose()
    }

    private async LoadAsync(): Promise<void> {
        this.Option.value.InstanceId = await AssetLoaderComponent.Default.LoadAsync(this.Option.value.Asset);
    }



    private FindNode(id: number): TreeNode | undefined {
        let node: TreeNode | undefined;

        function Find(id: number, input: TreeNode): void {
            if (input.Id == id) {
                node = input;
                return;
            }

            for (const child of input.Children) {
                Find(id, child);
            }
        }

        Find(id, this.Node);

        return node;
    }

    /**
     * 判断当年前节点是否有子节点
     * @param id 当前节点Id
     * @returns 是否有子节点
     */
    public HasChildren(id: number): boolean {
      return this.FindNode(id)?.HasChildren ?? false;
    }

    /**
     * 计算当前节点缩进级别
     * @param id 当前节点Id
     * @returns 当前节点缩进级别
     */
    public CalculateIndent(id: number): number {
        return this.FindNode(id)?.Indent ?? 0;
    }
    public CanShowNode(id: number): boolean {
        let node = this.FindNode(id)!;
        while (node.Parent != undefined) {
            if (!node.Parent.Expand) {
                return false;
            } else {
                node = node.Parent;
            }
        }
        return true;
    }

    public IsNodeExpand(id: number): boolean {
        return this.FindNode(id)?.Expand ?? false;
    }

    public SwitchNodeExpand(id: number): void {
        let node = this.FindNode(id)!;
        node.Expand = !node.Expand;
    }


    /**
     * Id发生变化时
     */
    private async OnIdChangedAsync(): Promise<void> {
        this.OptionId.value = this.Config.value.Options[0];
    }
    /**
     * 选项发生变化时
     * @param current 当前值
     * @param previous 过去值
     */
    private async OnOptionIdChangedAsync(current: number, previous: number): Promise<void> {
        MMWRComponent.Default.IsLoading.value = true;

        if (import.meta.env.PROD) {
            await GameObjectComponent.Default.HideAsync(this.Options.get(previous)!.InstanceId);

            // 清空标签
            LabelComponent.Default.Clear();
            // 重置高亮
            await HighlighterComponent.Default.ClearAsync();

            if (this.Option.value.InstanceId == 0) {
                const volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
                const effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(volume);

                // 加载模型
                this.Option.value.InstanceId = await AssetLoaderComponent.Default.LoadAsync(this.Option.value.Asset);

                await PostProcessLayerComponent.Default.RemoveEffectAsync(volume, effect);
                await PostProcessLayerComponent.Default.RemoveVolumeAsync(volume);
            }

            // 显示当前选项模型
            await GameObjectComponent.Default.ShowAsync(this.Option.value.InstanceId);

            // 切换视角
            await OrbitCameraComponent.Default.ApplyConfigAsync(this.Option.value.ViewId);

            if (this.Option.value.State != '') {
                // 播放动画
                await AnimatorComponent.Default.PlayAsync(this.Option.value.InstanceId, this.Option.value.State, 1000);
            }

            if (this.Option.value.Type == '组成') {
                // 加载标签
                await LabelComponent.Default.LoadAsync(this.Option.value.InstanceId);
            }
        }

        MMWRComponent.Default.IsLoading.value = false;
    }
}

class PrincipleConfig {
    Id: number;
    InstanceId: number;
    Name: string;
    Asset: string;
    /**
     * 动画状态
     */
    State: string;
    Description: string;
    ViewId: number;

    constructor(id: number, instanceId: number, name: string, asset: string, state: string, description: string, viewId: number) {
        this.Id = id;
        this.InstanceId = instanceId;
        this.Name = name;
        this.Asset = asset;
        this.State = state;
        this.Description = description;
        this.ViewId = viewId;
    }
}

/**
 * 工作原理
 */
export class PrincipleComponent {
    private static instance: PrincipleComponent = new PrincipleComponent();
    /**
     * 工作原理
     */
    public static get Default(): PrincipleComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.Id, this.OnIdChangedAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    /**
    * 当前原理配置
    */
    public Configs: UnwrapNestedRefs<Array<PrincipleConfig>> = reactive([
        new PrincipleConfig(
            1,
            0,
            '毫米波雷达测方位角原理',
            'Assets/R00034/ICV/Product/Principle/毫米波雷达系统/毫米波雷达测方位角原理.prefab',
            '',
            '毫米波雷达测方位角时，需要多个接收天线，发射无线电波，多个天线同时接收回波，因天线在不同的位置，接收到回波的时间会有所不同，根据接收回波的相位差，和多个天线之间的距离差，根据三角函数，就可以计算出障碍物的方位角。',
            2019),
        new PrincipleConfig(
            2,
            0,
            '毫米波雷达测距原理',
            'Assets/R00034/ICV/Product/Principle/毫米波雷达系统/毫米波雷达测距原理.prefab',
            '',
            '毫米波测距时，周期性的发射无线电波，遇到障碍物，会反射回波，发射的同时等待接收回波，根据收发的时间差测得目标的位置和相对距离，根据电磁波传播速度，可以确定目标距离公式为：S（距离）= C（光速）*（乘） t（收发时间差）/（除以）2。',
            2020),
        new PrincipleConfig(
            3,
            0,
            '毫米波雷达测速原理',
            'Assets/R00034/ICV/Product/Principle/毫米波雷达系统/毫米波雷达测速原理.prefab',
            '',
            '毫米波雷达测速是基于多普勒效应原理。也就是说，当发射的电磁波和被探测目标有相对移动，回波的频率会和发射波的频率不同。当目标向雷达天线靠近时，反射信号频率将高于发射信号频率；反之，当目标远离天线而去时，反射信号频率将低于发射信号频率。由多普勒效应所形成的频率变化叫做多普勒频移，它与相对速度v成正比，与振动的频率成反比。如此，通过检测这个频率差，可以测得目标相对于雷达的移动速度，也就是目标与雷达的相对速度。',
            2021),
    ]);

    /**
     * 当前原理配置Id
     */
    public Id: Ref<number> = ref(0);

    public Description: Ref<string> = ref('');
    public DescriptionAudioAccessibility: Ref<boolean> = ref(true);
    public AudioStats = reactive({ pausable: false });

    private watchStopHandles: Array<WatchStopHandle> = [];

    private instanceIds: Array<number> = [];

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetTransparentBackground();
        TooltipComponent.Default.Clear();

        if (this.instanceIds.length == 0) {
            await this.LoadAsync(this.Configs.map(config => config.Asset));
            this.Id.value = this.Configs[0].Id;
        } 
        // else {
        //     const config = this.Configs.find(config => config.Id == this.Id.value)!;
        //     await GameObjectComponent.Default.ShowAsync(config.InstanceId);
        // }
        // await OrbitCameraComponent.Default.ApplyConfigAsync(1013);

        const config = this.Configs.find(config => config.Id == this.Id.value)!;
        await GameObjectComponent.Default.ShowAsync(config.InstanceId);
        await OrbitCameraComponent.Default.ApplyConfigAsync(config.ViewId);

        //lock.Dispose();
        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();
        await GameObjectComponent.Default.HideAsync(this.instanceIds);
        //lock.Dispose();
        lock.Dispose();
    }

    private async LoadAsync(assets: Array<string>): Promise<void> {
        if (import.meta.env.DEV) {
            return;
        }

        const volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        const effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(volume);

        this.instanceIds.clear();
        this.instanceIds.addRange(await AssetLoaderComponent.Default.LoadAllAsync(assets));

        await PostProcessLayerComponent.Default.RemoveEffectAsync(volume, effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(volume);

        for (let index = 0; index < this.instanceIds.length; ++index) {
            const instanceId = this.instanceIds[index];
            this.Configs[index].InstanceId = instanceId;
        }

        await GameObjectComponent.Default.HideAsync(this.instanceIds);
    }

    /**
     * 原理Id发生变化时
     * @param value 值
     */
    private async OnIdChangedAsync(value: number, previous: number): Promise<void> {
        // 更新结构数据
        const config = this.Configs.find(config => config.Id == value);

        await GameObjectComponent.Default.ShowAsync(config!.InstanceId);
        await OrbitCameraComponent.Default.ApplyConfigAsync(config!.ViewId);

        const previousConfig = this.Configs.find(config => config.Id == previous);
        if (import.meta.env.PROD) {
            if (config != null) {
                if (previousConfig != null) {
                    await GameObjectComponent.Default.HideAsync(previousConfig.InstanceId);
                }

                await GameObjectComponent.Default.ShowAsync(config.InstanceId);
            } else {
                window.Logger.Error(`对应选项(Id:${value})不存在`);
            }
        }

        this.Description.value = config?.Description ?? '';
    }
}

class InstallStepConfig {
    Id: number;
    Name: string;
    Asset: string;

    constructor(id: number, name: string, asset: string) {
        this.Id = id;
        this.Name = name;
        this.Asset = asset;
    }
}

class InstallViewConfig {
    Id: number;
    Name: string;
    Icon: string;

    constructor(id: number, name: string, icon: string) {
        this.Id = id;
        this.Name = name;
        this.Icon = icon;
    }
}

/**
 * 安装组件
 */
export class InstallComponent {
    private static instance: InstallComponent = new InstallComponent();
    /**
     * 安装组件
     */
    public static get Default(): InstallComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.ViewId, this.OnViewChangedAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    public StepDescriptions = ref<any>([
        {name:'1.安装毫米波雷达',type:false},
        {name:'2.安装毫米波雷达固定螺栓',type:false},
        {name:'3.安装CAN卡',type:false},
        {name:'4.安装计算平台',type:false},
        {name:'5.安装毫米波雷达线束',type:false},
        {name:'6.安装CAN转USB数据线',type:false},
        {name:'7.安装毫米波雷达电源',type:false},
        {name:'8.安装计算平台电源',type:false},
    ]); 

    /**
     * 步骤提示
     */
    public StepTips: Array<InstallStepConfig> = [
        new InstallStepConfig(1, '步骤一', 'Step001.png'),
        new InstallStepConfig(2, '步骤二', 'Step002.png'),
        new InstallStepConfig(3, '步骤三', 'Step003.png'),
        new InstallStepConfig(4, '步骤四', 'Step004.png'),
    ];

    /**
     * 视角配置
     */
    public Views: Array<InstallViewConfig> = [
        new InstallViewConfig(2023, '目标', 'ic_mubiao'),
        new InstallViewConfig(2024, '零件桌', 'ic_lingjianzhuo'),
        new InstallViewConfig(2025, '车顶', 'ic_cheding'),
        new InstallViewConfig(2026, '车前', 'ic_cheqian'),
    ];

    public CanRecyclePart: ComputedRef<boolean> = computed(() => this.ViewId.value == 2024);

    public ViewId: Ref<number> = ref(0);

    public StepState: Ref<boolean> = ref(false);

    private watchStopHandles: Array<WatchStopHandle> = [];

    private instanceIds: Array<number> = [];

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetTransparentBackground();
        TooltipComponent.Default.Clear();

        await RoomComponent.Default.ShowAsync();

        if (import.meta.env.PROD) {
            if (this.instanceIds.length == 0) {
                await this.LoadAsync([
                    'Assets/R00034/ICV/Product/DisassemblyAndAssembly/毫米波雷达系统/零件桌.prefab',
                    'Assets/R00034/ICV/Product/DisassemblyAndAssembly/毫米波雷达系统/毫米波雷达系统安装.prefab'
                ]);
            } else {
                await GameObjectComponent.Default.ShowAsync(this.instanceIds);
            }
        }

        this.ViewId.value = this.Views[0].Id;
        await OrbitCameraComponent.Default.ApplyConfigAsync(this.ViewId.value);

        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        this.StepState.value = false;

        await GameObjectComponent.Default.HideAsync(this.instanceIds);

        await RoomComponent.Default.HideAsync();

        lock.Dispose();
    }

    private async LoadAsync(assets: Array<string>): Promise<void> {
        const volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        const effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(volume);

        this.instanceIds.clear();
        this.instanceIds.addRange(await AssetLoaderComponent.Default.LoadAllAsync(assets));

        await PostProcessLayerComponent.Default.RemoveEffectAsync(volume, effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(volume);

        await InteractableObjectComponent.Default.LoadAsync(['MillimeterWaveRadar', 'MillimeterWaveRadarLocation']);
    }

    /**
     * 安装视角发生变化
     * @param viewId 值
     */
    private async OnViewChangedAsync(viewId: number): Promise<void> {
        if (import.meta.env.PROD) {
            OrbitCameraComponent.Default.ApplyConfigAsync(viewId);
        } else {
            window.Logger.Debug(`视角切换: ${viewId}`);
        }
    }

    public async RecycleAsync(id: number, instanceId: number): Promise<void> {
        InteractableObjectComponent.Default.Remove(id);
        await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.UncheckInteractableObjectRequest(id, instanceId));
        InteractableObjectComponent.Default.Choices.value.length -= 1        
    }
}

class CalibrationConfig {
    Id: number;
    Name: string;
    Asset: string;
    Options: Array<string>;
    ViewId: number;

    Descriptions: Map<string, string>;
    Records: Map<string, number>;

    /**
     * 物体实例Id
     */
    InstanceId: number;
    /**
     * 原点实例Id
     */
    Origin: number;
    /**
     * 是否显示原点
     */
    ShowOrigin: boolean;
    /**
     * 标定值
     */
    Values: Array<number>;

    constructor(id: number, name: string, asset: string, options: Array<string>, viewId: number, descriptions: Map<string, string>, records: Map<string, number>, instanceId: number = 0, origin: number = 0, showOrigin: boolean = false, values: Array<number> = []) {
        this.Id = id;
        this.Name = name;
        this.Asset = asset;
        this.Options = options;
        this.ViewId = viewId;

        this.Descriptions = descriptions;
        this.Records = records;

        this.InstanceId = instanceId;
        this.Origin = origin;
        this.ShowOrigin = showOrigin;
        this.Values = values;
    }
}

/**
 * 标定组件
 */
export class CalibrationComponent {
    private static instance: CalibrationComponent = new CalibrationComponent();
    /**
     * 标定组件
     */
    public static get Default(): CalibrationComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.Id, this.OnIdChangedAsync.bind(this)));
        this.watchStopHandles.push(watch(this.ShowOrigin, this.OnOriginStateChangedAsync.bind(this)));
        this.watchStopHandles.push(watch(this.ShowTips, this.OnPopupChangedAsync.bind(this)));
        this.watchStopHandles.push(watch(this.ShowForms, this.OnPopupChangedAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    public Configs: UnwrapNestedRefs<Map<number, CalibrationConfig>> = reactive(ToMap<number, CalibrationConfig>([
        new CalibrationConfig(1, '车辆坐标系标定',
            'Assets/R00034/ICV/Product/Calibration/毫米波雷达标定/毫米波雷达车辆坐标系标定.prefab',
            ['显示原点', '标定说明', '参数标定'],
            2028,
            new Map<string, string>([
                ["Car_W", "车辆左侧至右侧距离:"],
                ["Car_L", "车辆前侧至后侧距离:"],
                ["Radar_X", "毫米波雷达中心至车辆左侧距离:"],
                ["Radar_Y", "毫米波雷达中心至车辆前侧距离:"],
                ["Radar_Z", "毫米波雷达中心至地面高度:"],
                ["Source_X", "车辆后轴中心至车辆左侧距离:"],
                ["Source_Y", "车辆后轴中心至车辆前(后)侧距离:"],
                ["Source_Z", "车辆后轴中心至地面距离:"],
            ]),
            new Map<string, number>([
                ["Car_W", 0],
                ["Car_L", 0],
                ["Radar_X", 0],
                ["Radar_Y", 0],
                ["Radar_Z", 0],
                ["Source_X", 0],
                ["Source_Y", 0],
                ["Source_Z", 0],
            ]),
        ),
        new CalibrationConfig(2, '姿态标定',
            'Assets/R00034/ICV/Product/Calibration/毫米波雷达标定/毫米波雷达车辆姿态标定.prefab',
            ['标定说明'],
            2029,
            new Map<string, string>(),
            new Map<string, number>([
                ["Yaw", 0],
                ["Pitch", 0],
                ["Roll", 0],
                ["Distance", 0],
            ]),
        )
    ], element => element.Id));

    /**
     * 当前标定配置Id
     */
    public Id: Ref<number> = ref(1);

    public Config: ComputedRef<CalibrationConfig> = computed(() => this.Configs.get(this.Id.value)!);

    public Options: ComputedRef<Array<string>> = computed(() => this.Config.value.Options);

    /**
     * 姿态标定角度
     */
    private attibuteAngles: Array<number> = [0, 0, 0];

    public Tips = [
        '标定说明001.png',
        '标定说明002.png',
        '标定说明003.png',
    ];

    /**
    * 显示原点
    */
    public ShowOrigin: Ref<boolean> = ref(false);
    /**
     * 显示标定说明
     */
    public ShowTips: Ref<boolean> = ref(false);
    /**
     * 显示参数标定
     */
    public ShowForms: Ref<boolean> = ref(false);

    public AttitudeState: Ref<boolean> = ref(false);
    public AttitudePercent: Ref<number> = ref(0);

    private hasInitialized: boolean = false;

    private volume: number = 0;
    private effect: number = 0;

    private watchStopHandles: Array<WatchStopHandle> = [];

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetTransparentBackground();
        TooltipComponent.Default.Clear();

        await RoomComponent.Default.ShowAsync();

        if (!this.hasInitialized) {
            await this.LoadAsync();
            this.hasInitialized = true;
        }

        await GameObjectComponent.Default.ShowAsync(this.Config.value.InstanceId);
        await OrbitCameraComponent.Default.ApplyConfigAsync(this.Config.value.ViewId);

        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        await GameObjectComponent.Default.HideAsync(this.Config.value.InstanceId);

        await RoomComponent.Default.HideAsync();

        // 隐藏坐标系尺寸标注
        TooltipComponent.Default.Clear();

        lock.Dispose();
    }

    /**
     * 切换原点显示状态
     * @param value 状态
     */
    private async OnOriginStateChangedAsync(value: boolean): Promise<void> {
        this.Config.value.ShowOrigin = value;

        if (value) {
            await GameObjectComponent.Default.ShowAsync(this.Config.value.Origin);
        } else {
            await GameObjectComponent.Default.HideAsync(this.Config.value.Origin);
        }
    }

    private async OnPopupChangedAsync(value: boolean): Promise<void> {
        if (value) {
            this.volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
            this.effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(this.volume);
        } else {
            await PostProcessLayerComponent.Default.RemoveEffectAsync(this.volume, this.effect);
            await PostProcessLayerComponent.Default.RemoveVolumeAsync(this.volume);
        }
    }

    private async LoadAsync(): Promise<void> {
        if (import.meta.env.DEV) {
            return;
        }

        const volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        const effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(volume);

        const instanceIds = await AssetLoaderComponent.Default.LoadAllAsync(Array.from(this.Configs.values()).map(config => config.Asset));
        await GameObjectComponent.Default.HideAsync(instanceIds);
        const keys = Array.from(this.Configs.keys());
        for (let i = 0; i < keys.length; ++i) {
            this.Configs.get(keys[i])!.InstanceId = instanceIds[i];
        }

        // 初始化坐标系标定
        const gizmos: ClientMessage.MillimeterWaveRadarGizmosResponse = await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarGizmosRequest(this.Configs.get(1)!.InstanceId));
        this.Config.value.Origin = gizmos.Origin;
        this.Config.value.Values.addRange(gizmos.Values.map(value => Math.round(value * Math.pow(10, 2)) / Math.pow(10, 2)));

        // 初始化姿态标定
        const attitude: ClientMessage.MillimeterWaveRadarAttitudeResponse = await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarAttitudeRequest(this.Configs.get(2)!.InstanceId));
        const config = this.Configs.get(2)!;
        config.Records.set('Yaw', attitude.Yaw);
        config.Records.set('Pitch', attitude.Pitch);
        config.Records.set('Roll', attitude.Roll);
        config.Records.set('Distance', attitude.Distance);

        await PostProcessLayerComponent.Default.RemoveEffectAsync(volume, effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(volume);
    }

    /**
     * 标定Id发生变化时
     * @param current 值
     */
    private async OnIdChangedAsync(current: number, previous: number): Promise<void> {
        if (import.meta.env.PROD) {
            TooltipComponent.Default.Clear();

            await GameObjectComponent.Default.HideAsync(this.Configs.get(previous)!.InstanceId);

            await GameObjectComponent.Default.ShowAsync(this.Config.value.InstanceId);

            await OrbitCameraComponent.Default.ApplyConfigAsync(this.Config.value.ViewId);
        }

        this.ShowOrigin.value = this.Config.value.ShowOrigin;
    }

    public async OnAttitudeAnglesUpdateAsync(yaw: number, pitch: number, roll: number): Promise<boolean> {
        if (this.attibuteAngles[0] == yaw && this.attibuteAngles[1] == pitch && this.attibuteAngles[2] == roll) {
            return false;
        }
        this.attibuteAngles[0] = yaw;
        this.attibuteAngles[1] = pitch;
        this.attibuteAngles[2] = roll;

        const response = await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarAttitudeAnglesUpdateRequest(yaw, pitch, roll));
        return response.Error == 0;
    }

    public async SubmitAttitudeAsync(yaw: number, pitch: number, roll: number): Promise<void> {
        this.volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        this.effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(this.volume);

        const standardYaw = this.Config.value.Records.get('Yaw')!;
        const standardPitch = this.Config.value.Records.get('Pitch')!;
        const standardRoll = this.Config.value.Records.get('Roll')!;

        const max = Math.sqrt(Math.pow(standardYaw, 2) + Math.pow(standardPitch, 2) + Math.pow(standardRoll, 2));
        const current = Math.sqrt(Math.pow(yaw - standardYaw, 2) + Math.pow(pitch - standardPitch, 2) + Math.pow(roll - standardRoll, 2));
        const percent = 100 - Math.clamp(current / max * 100 | 0, 0, 100);

        // 95~100 优秀
        // 90~95 良好
        // 80~90 合格
        // ~80 不合格

        this.AttitudePercent.value = percent;
        this.AttitudeState.value = true;
    }

    public async ConfirmAttitudeAsync(): Promise<void> {
        this.AttitudeState.value = false;

        await PostProcessLayerComponent.Default.RemoveEffectAsync(this.volume, this.effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(this.volume);
    }

    public async SubmitGizmosAsync(values: Array<number>): Promise<void> {
        const keys = Array.from(this.Configs.keys());
        const success = values.map(value => Math.round(value * Math.pow(10, 2)) / Math.pow(10, 2)).toString() == this.Configs.get(keys[0])!.Values.toString();
        const options = ModalOptions.Default()
            .WithPrefix('/src/components/Apps/MMWR/')
            .WithType('MessageBox')
            .WithContent(success ? '标定成功' : '标定失败')
            .WithButtons(['确定']);
        await ModalComponent.Default.PopupAsync(options);
    }
}

/**
 * 协议定义
 */
export class ProtocolDefinitionConfig {
    Id: number;
    Type: number;
    Sign: string;
    StartIndex: string;
    Length: string;
    Min: string;
    Max: string;
    Resolution: string;
    Unit: string;
    Description: string;

    Value: string = '';
    Reference: string = '';

    constructor(id: number, type: number, sign: string, startIndex: string, length: string, min: string, max: string, resolution: string, unit: string, description: string) {
        this.Id = id;
        this.Type = type;
        this.Sign = sign;
        this.StartIndex = startIndex;
        this.Length = length;
        this.Min = min;
        this.Max = max;
        this.Resolution = resolution;
        this.Unit = unit;
        this.Description = description;
    }
}

//#region 线束类型

// 0 ◀————————
// 1 ◀————————◁
// 2 ◀————————◀
// 3 ◁————————
// 4 ◁————————◁
// 5 ◁————————◀
// 6  ————————
// 7  ————————◁
// 8  ————————◀

//#endregion

/**
 * 协议图表定义
 */
export class ProtocolGraphConfig {
    Id: number;
    Type: number;
    Index: number;
    Line: string;
    LT: string;
    LB: string;
    Color: string;

    constructor(id: number, type: number, index: number, line: string, lt: string, lb: string, color: string) {
        this.Id = id;
        this.Type = type;
        this.Index = index;
        this.Line = line;
        this.LT = lt;
        this.LB = lb;
        this.Color = color;
    }
}

/**
 * 协议解读组件
 */
export class ProtocolComponent {
    private static instance: ProtocolComponent = new ProtocolComponent();
    /**
     * 协议解读组件
     */
    public static get Default(): ProtocolComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.Type, this.OnTypeChangedAsync.bind(this)));
        this.watchStopHandles.push(watch(this.DataSource, this.OnDataSourceChanged.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    public  DefinitionConfigs: Array<ProtocolDefinitionConfig> = [
        // { "Id": 1001, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_NVMReadStatus", "StartIndex": "6", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：失败\n0x1：成功", "Description": "启动时从非易失性存储器读取配置参数的状态" },
        // { "Id": 1002, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_NVMwriteStatus", "StartIndex": "7", "Length": "1", "Min": "0", "Max":  "1", "Resolution": "1", "Unit": "0x0：失败\n0x1：成功", "Description": "将配置参数存储到非易失性存储器中的状态（最初该值设置为0x0，在配置发送和成功存储后设置为0x1）" },
        // { "Id": 1003, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_MaxDistanceCfg", "StartIndex": "22", "Length": "10", "Min": "0", "Max": "2046", "Resolution": "2", "Unit": "m (标准版本支持196 m-260 m 可配置)", "Description": "最大距离的配置" },
        // { "Id": 1004, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_Persistent_Error", "StartIndex": "21", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：没有错误\n0x1：持续错误激活", "Description": "内部错误，在检测到重置后可能不会消失。" },
        // { "Id": 1005, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_Interference", "StartIndex": "20", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：无干扰\n0x1：检测到干扰", "Description": "已探测到与另一个雷达传感器的干扰。" },
        // { "Id": 1006, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_Temperature_Error", "StartIndex": "19", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：无错误\n0x1：温度错误激活", "Description": "如果温度低于或高于定义的范围，错误将被激活。" },
        // { "Id": 1007, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_Temporary_Error", "StartIndex": "18", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：无错误\n0x1：临时错误激活", "Description": "在传感器复位后，可能会消失的临时错误。" },
        // { "Id": 1008, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_Voltage_Error", "StartIndex": "17", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：无错误\n0x1：电压错误激活", "Description": "如果工作电压低于或高于定义的范围超过5秒钟，错误将被激活。" },
        // { "Id": 1009, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SensorID", "StartIndex": "32", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "传感器ID（0-7）", "Description": "传感器ID 0-7" },
        // { "Id": 1010, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SortIndex", "StartIndex": "36", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：不分类\n0x1：按范围排序\n0x2：按RCS排序", "Description": "当前object列表排列索引方式" },
        // { "Id": 1011, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_RadarPowerCfg", "StartIndex": "39", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：标准\n0x1：-3dB 发射增益\n0x2：-6dB 发射增益\n0x3：-9dB 发射增益", "Description": "雷达功率参数的配置" },
        // { "Id": 1012, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_CtrlRelayCfg", "StartIndex": "41", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "如果为真，则发送继电器控制消息" },
        // { "Id": 1013, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_OutputTypeCfg", "StartIndex": "42", "Length": "2", "Min": "0", "Max": "3", "Resolution": "1", "Unit": "0x0：无\n0x1：objects\n0x2：clusters", "Description": "当前输出类型为clusters或objects" },
        // { "Id": 1014, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SendQualityCfg", "StartIndex": "44", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "如果为真，则发送clusters或objects的质量信息" },
        // { "Id": 1015, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SendExtInfoCfg", "StartIndex": "45", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "如果为真，则发送objects的扩展信息" },
        // { "Id": 1016, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_MotionRxState", "StartIndex": "46", "Length": "2", "Min": "0", "Max": "3", "Resolution": "1", "Unit": "0x0：输入ok\n0x1：速度缺失\n0x2：横摆角速度缺失\n0x3：速度和横摆角速度缺失", "Description": "显示输入信号速度和横摆角速度的状态。" },
        // { "Id": 1017, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_RCS_Threshold", "StartIndex": "58", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0 标准\n0x1 高灵敏度", "Description": "如果为真，责激活传感器的高灵敏度" },
        // { "Id": 1018, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_InvalidClusters", "StartIndex": "48", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "0x0 禁用所有Invalidclusters\n0x1 启用所有Invalidclusters\n0x2 启用低RCS动态\n0x4 启用低RCS 静态\n0x8 启用无效范围速率\n0x10 启用范围<1m\n0x20启用自我反射\n0x40 启用覆盖静止", "Description": "显示为输出选择了哪些InvalidClusters" },
        { "Id": 1001, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_NVMReadStatus", "StartIndex": "6", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：失败\n0x1：成功", "Description": "启动时从非易失性存储器读取配置参数的状态" },
        { "Id": 1002, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_NVMwriteStatus", "StartIndex": "7", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：失败\n0x1：成功", "Description": "将配置参数存储到非易失性存储器中的状态（最初该值设置为0x0，在配置发送和成功存储后设置为0x1）" },
        { "Id": 1003, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_MaxDistanceCfg", "StartIndex": "22", "Length": "10", "Min": "0", "Max": "2046", "Resolution": "2", "Unit": "m (标准版本支持196 m-260 m 可配置)", "Description": "最大距离的配置" },
        { "Id": 1009, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SensorID", "StartIndex": "32", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "传感器ID（0-7）", "Description": "传感器ID 0-7" },
        { "Id": 1010, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SortIndex", "StartIndex": "36", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：不分类\n0x1：按范围排序\n0x2：按RCS排序", "Description": "当前object列表排列索引方式" },
        { "Id": 1011, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_RadarPowerCfg", "StartIndex": "39", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：标准\n0x1：-3dB 发射增益\n0x2：-6dB 发射增益\n0x3：-9dB 发射增益", "Description": "雷达功率参数的配置" },
        { "Id": 1012, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_CtrlRelayCfg", "StartIndex": "41", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "如果为真，则发送继电器控制消息" },
        { "Id": 1013, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_OutputTypeCfg", "StartIndex": "42", "Length": "2", "Min": "0", "Max": "3", "Resolution": "1", "Unit": "0x0：无\n0x1：objects\n0x2：clusters", "Description": "当前输出类型为clusters或objects" },
        { "Id": 1014, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SendQualityCfg", "StartIndex": "44", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "如果为真，则发送clusters或objects的质量信息" },
        { "Id": 1015, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_SendExtInfoCfg", "StartIndex": "45", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "如果为真，则发送objects的扩展信息" },
        { "Id": 1016, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_MotionRxState", "StartIndex": "46", "Length": "2", "Min": "0", "Max": "3", "Resolution": "1", "Unit": "0x0：输入ok\n0x1：速度缺失\n0x2：横摆角速度缺失\n0x3：速度和横摆角速度缺失", "Description": "显示输入信号速度和横摆角速度的状态。" },
        { "Id": 1017, "Type": 0x201, "Value": '', "Reference": '', "Sign": "RadarState_RCS_Threshold", "StartIndex": "58", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0 标准\n0x1 高灵敏度", "Description": "如果为真，责激活传感器的高灵敏度" },
        
        { "Id": 1101, "Type": 0x203, "Value": '', "Reference": '', "Sign": "FilterState_NofClusterFilterCfg", "StartIndex": "3", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "", "Description": "已配置的Cluster过滤器的状态消息数量" },
        { "Id": 1102, "Type": 0x203, "Value": '', "Reference": '', "Sign": "FilterState_NofObjectFilterCfg", "StartIndex": "11", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "", "Description": "已配置的Object过滤器的状态消息数量" },
        { "Id": 1201, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Active", "StartIndex": "22", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：无效\n0x1：有效", "Description": "过滤器激活开关" },
        { "Id": 1202, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Index", "StartIndex": "3", "Length": "4", "Min": "0", "Max": "15", "Resolution": "1", "Unit": "见表4", "Description": "指定要配置的过滤条件（0x0到0xF）" },
        { "Id": 1203, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Type", "StartIndex": "7", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：Cluster过滤\n0x1：Object过滤", "Description": "可在object或cluster过滤器配置之间进行选择" },
        { "Id": 1204, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_NofObj", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "4095", "Resolution": "1", "Unit": "不使用", "Description": "过滤条件的最小值。" },
        { "Id": 1205, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_Distance", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "409.5", "Resolution": "0.1", "Unit": "m", "Description": "过滤条件的最小值。" },
        { "Id": 1206, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_Azimuth", "StartIndex": "16", "Length": "12", "Min": "-50", "Max": "52.378", "Resolution": "0.025", "Unit": "deg", "Description": "过滤条件的最小值。" },
        { "Id": 1207, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_VrelOncome", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最小值。" },
        { "Id": 1208, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_VrelDepart", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最小值。" },
        { "Id": 1209, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_RCS", "StartIndex": "16", "Length": "12", "Min": "-50", "Max": "52.375", "Resolution": "0.025", "Unit": "dBm2", "Description": "过滤条件的最小值。" },
        { "Id": 1210, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_Lifetime", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "409.5", "Resolution": "0.1", "Unit": "s", "Description": "过滤条件的最小值。" },
        { "Id": 1211, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_Size", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "102.375", "Resolution": "0.025", "Unit": "m2", "Description": "过滤条件的最小值。" },
        { "Id": 1212, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_ProbExists", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：0%\n0x1：25%\n0x2：50%\n0x3：75%\n0x4：90%\n0x5：99%\n0x6：99.9%\n0x7：100%", "Description": "过滤条件的最小值。" },
        { "Id": 1213, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_Y", "StartIndex": "16", "Length": "12", "Min": "-409.5", "Max": "409.5", "Resolution": "0.2", "Unit": "m", "Description": "过滤条件的最小值。" },
        { "Id": 1214, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_X", "StartIndex": "16", "Length": "", "Min": "-500", "Max": "1138.2", "Resolution": "0.2", "Unit": "m", "Description": "过滤条件的最小值。" },
        { "Id": 1215, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_VYLeftRight", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最小值。" },
        { "Id": 1216, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_VXOncome", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最小值。" },
        { "Id": 1217, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_VYRightLeft", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最小值。" },
        { "Id": 1218, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Min_VXDepart", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最小值。" },
        { "Id": 1219, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_NofObj", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "4095", "Resolution": "1", "Unit": "", "Description": "过滤条件的最大值。" },
        { "Id": 1220, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_Distance", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "409.5", "Resolution": "0.1", "Unit": "m", "Description": "过滤条件的最大值。" },
        { "Id": 1221, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_Azimuth", "StartIndex": "32", "Length": "12", "Min": "-50", "Max": "52.375", "Resolution": "0.025", "Unit": "deg", "Description": "过滤条件的最大值。" },
        { "Id": 1222, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_VrelOncome", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最大值。" },
        { "Id": 1223, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_VrelDepart", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最大值。" },
        { "Id": 1224, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_RCS", "StartIndex": "32", "Length": "12", "Min": "-50", "Max": "52.975", "Resolution": "0.025", "Unit": "dBm2", "Description": "过滤条件的最大值。" },
        { "Id": 1225, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_Lifetime", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "409.5", "Resolution": "0.1", "Unit": "s", "Description": "过滤条件的最大值。" },
        { "Id": 1226, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_Size", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "102.375", "Resolution": "0.025", "Unit": "m2", "Description": "过滤条件的最大值。" },
        { "Id": 1227, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_ProbExists", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：0%\n0x1：25%\n0x2：50%\n0x3：75%\n0x4：90%\n0x5：99%\n0x6：99.9%\n0x7：100%", "Description": "过滤条件的最大值。" },
        { "Id": 1228, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_Y", "StartIndex": "16", "Length": "12", "Min": "-409.5", "Max": "409.5", "Resolution": "0.2", "Unit": "m", "Description": "过滤条件的最大值。" },
        { "Id": 1229, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_X", "StartIndex": "16", "Length": "", "Min": "-500", "Max": "1138.2", "Resolution": "0.2", "Unit": "m", "Description": "过滤条件的最大值。" },
        { "Id": 1230, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_VYLeftRight", "StartIndex": "16", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最大值。" },
        { "Id": 1231, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_VXOncome", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最大值。" },
        { "Id": 1232, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_VYRightLeft", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最大值。" },
        { "Id": 1233, "Type": 0x204, "Value": '', "Reference": '', "Sign": "FilterState_Max_VXDepart", "StartIndex": "32", "Length": "12", "Min": "0", "Max": "128.993", "Resolution": "0.0315", "Unit": "m/s", "Description": "过滤条件的最大值。" },
        { "Id": 1302, "Type": 0x408, "Value": '', "Reference": '', "Sign": "CollDetState_NofRegions", "StartIndex": "4", "Length": "4", "Min": "0", "Max": "8", "Resolution": "1", "Unit": "", "Description": "已配置区域的数量" },
        { "Id": 1301, "Type": 0x408, "Value": '', "Reference": '', "Sign": "CollDetState_Activation", "StartIndex": "1", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0：未激活\n0x1：激活", "Description": "碰撞检测状态激活" },
        { "Id": 1303, "Type": 0x408, "Value": '', "Reference": '', "Sign": "CollDetState_MinDetectTime", "StartIndex": "8", "Length": "8", "Min": "0.0", "Max": "25.5", "Resolution": "0.1", "Unit": "s", "Description": "目标的最小报警触发的时间的配置" },
        { "Id": 1303, "Type": 0x408, "Value": '', "Reference": '', "Sign": "CollDetState_MeasCounter", "StartIndex": "24", "Length": "16", "Min": "0", "Max": "66635", "Resolution": "1", "Unit": "", "Description": "测量循环计数器（自传感器启动以来计数，并在> \n65535时重新启动）" },
        { "Id": 1401, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_WarningLevel", "StartIndex": "3", "Length": "2", "Min": "0", "Max": "0", "Resolution": "1", "Unit": "0x0：无报警\n0x1：目标报警\n0x2：未使用\n0x3：停止报警", "Description": "表示某个对象位于该区域内，或者曾经在区内。\n如果它是0x0，则该区域内未检测到任何目标。\n如果它是0x1，则当前有物体位于该区域内并且\n已超过了CollDetCfg_MinTime中配置的最小检\n测时间。\n0x2为未使用。\n如果它是0x3，则之前有一个目标已进入该区域，\n但现在已经离开。\n要将警告级别重置为0x0，请使用\nCollDetCfg_WarningReset" },
        { "Id": 1402, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_RegionID", "StartIndex": "5", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "", "Description": "当前区域的ID编号" },
        { "Id": 1403, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_Point1X", "StartIndex": "19", "Length": "13", "Min": "-500", "Max": "1138.2", "Resolution": "0.2", "Unit": "m", "Description": "1st X（纵向）矩形区域的坐标" },
        { "Id": 1404, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_Point1Y", "StartIndex": "24", "Length": "11", "Min": "-204.6", "Max": "204.8", "Resolution": "0.2", "Unit": "m", "Description": "1st Y（横向）矩形区域的坐标" },
        { "Id": 1405, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_Point2X", "StartIndex": "43", "Length": "13", "Min": "-500", "Max": "1138.2", "Resolution": "0.2", "Unit": "m", "Description": "2nd X（纵向）矩形区域的坐标" },
        { "Id": 1406, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_Point2Y", "StartIndex": "48", "Length": "11", "Min": "-204.6", "Max": "204.8", "Resolution": "0.2", "Unit": "m", "Description": "2nd Y（横向）矩形区域的坐标" },
        { "Id": 1407, "Type": 0x402, "Value": '', "Reference": '', "Sign": "CollDetRegState_NofObjects", "StartIndex": "56", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "当前在区域内检测到的满足碰撞检测条件的目标数量。" },
        { "Id": 1501, "Type": 0x600, "Value": '', "Reference": '', "Sign": "Cluster_NofClustersNear", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "近距离扫描中检测到的clusters点数" },
        { "Id": 1502, "Type": 0x600, "Value": '', "Reference": '', "Sign": "Cluster_NofClustersFar", "StartIndex": "8", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "远程扫描中检测到的clusters点数量（近距离和远距离\n一起最多输出250个clusters点;在激活质量信息应用的\n情况下输出110-120clusters点，以避免CAN总线负载超\n限）" },
        { "Id": 1503, "Type": 0x600, "Value": '', "Reference": '', "Sign": "Cluster_MeasCounter", "StartIndex": "24", "Length": "16", "Min": "0", "Max": "65535", "Resolution": "1", "Unit": "", "Description": "测量循环计数器（自传感器启动以来计数，并在>65535\n时重新启动计数）" },
        { "Id": 1504, "Type": 0x600, "Value": '', "Reference": '', "Sign": "Cluster_InterfaceVersion", "StartIndex": "36", "Length": "4", "Min": "0", "Max": "15", "Resolution": "1", "Unit": "", "Description": "Cluster列表接口版本" },
        { "Id": 1601, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_ID", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "Cluster 编号" },
        { "Id": 1602, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_DistLong", "StartIndex": "19", "Length": "13", "Min": "-500", "Max": "1138.2", "Resolution": "0.2", "Unit": "m", "Description": "纵向（x）坐标" },
        { "Id": 1603, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_DistLat", "StartIndex": "24", "Length": "10", "Min": "-102.3", "Max": "102.3", "Resolution": "0.2", "Unit": "m", "Description": "横向（y）坐标" },
        { "Id": 1604, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_VrelLong", "StartIndex": "46", "Length": "10", "Min": "-128.00", "Max": "127.75", "Resolution": "0.25", "Unit": "m/s", "Description": "纵向相对速度（x）" },
        { "Id": 1605, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_DynProp", "StartIndex": "48", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：移动的\n0x1：静止的\n0x2：来向的\n0x3：可能静止的\n0x4：未知的\n0x5：横穿静止的\n0x6：横穿的\n0x7：停止的", "Description": "cluster动态属性表示是否移动" },
        { "Id": 1606, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_VrelLat", "StartIndex": "53", "Length": "9", "Min": "-64.00", "Max": "63.75", "Resolution": "0.25", "Unit": "m/s", "Description": "横向相对速度（y）" },
        { "Id": 1607, "Type": 0x701, "Value": '', "Reference": '', "Sign": "Cluster_RCS", "StartIndex": "56", "Length": "8", "Min": "-64.0", "Max": "63.5", "Resolution": "0.5", "Unit": "dBm2", "Description": "雷达散射截面积" },
        { "Id": 1701, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_ID", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "Cluster 编号" },
        { "Id": 1702, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_DistLong_rms", "StartIndex": "11", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "", "Description": "纵向距离的标准差" },
        { "Id": 1703, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_VrelLong_rms", "StartIndex": "17", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "", "Description": "横向距离的标准差" },
        { "Id": 1704, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_DistLat_rms", "StartIndex": "22", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "", "Description": "纵向速度的标准差" },
        { "Id": 1705, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_Pdh0", "StartIndex": "24", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：无效\n0x1：<25%\n0x2：<50%\n0x3：<75%\n0x4：<90%\n0x5：<99%\n0x6：<99.9%\n0x7：<=100%", "Description": "Cluster的误报概率（即由多路径或类似原因引起的人为事件的概率）" },
        { "Id": 1706, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_VrelLat_rms", "StartIndex": "28", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "", "Description": "横向速度的标准差" },
        { "Id": 1707, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_AmbigState", "StartIndex": "32", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：无效(无法使用)\n0x1： 模糊度 (cluster不清楚，因为有模糊(黑暗，模糊)， (不应该使用，也不推荐，因为它可能出现两次甚至更多次)\n0x2 ： 交 错 斜 坡(cluster的模糊性(模糊性)得到了部分的解决，因此cluster的模糊性不明显)，(不应该使用，也不推荐)\n0x3： 明确的(一切都清楚，模糊（模糊）已经解决-可以使用和建议使用)\n0x4： 静止状态(一切都很清楚，可能有一些固定的（固定的）因为模糊性已经解决-它可以被使用并推荐使用)", "Description": "多普勒状态（径向速度）模糊度（见表38中的第七个原始更多细节）" },
        { "Id": 1708, "Type": 0x702, "Value": '', "Reference": '', "Sign": "Cluster_InvalidState", "StartIndex": "35", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "0x00：有效\n0x01：由于RCS较低而无效\n0x02：由于近距的物品而无效\n0x03：因为未在近距离内确认，远Cluster无效。\n0x04：具有低RCS的有效Cluster\n0x05：保留位\n0x06：具有低RCS的有效Cluster\n0x07：因外部传感器视野而无效\n0x08：由于高度而具有方位角校正的有效的Cluster\n0x09：具有高概率的有效的Cluster\n0x0A：具有50%可能的 伪 影 造 成 的 有 效Cluster\n0x0B：没有最大值的有Cluster\n0x0C：具有高伪影概率的有效Cluster\n0x0D：保留位\n0x0E：由于谐波而造成的无效Cluster\n0x0F：在近范围内超过95米的有效Cluster\n0x10：具有高概率多目标的有效的cluster\n0x11：具有可疑角度的有效cluster", "Description": "Cluster有效性状态（有关详细信息，请参阅表38）" },
        { "Id": 1801, "Type": 0x60A, "Value": '', "Reference": '', "Sign": "Object_NofObjects", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "objects数量(最大100 Objects)" },
        { "Id": 1802, "Type": 0x60A, "Value": '', "Reference": '', "Sign": "Object_MeasCounter", "StartIndex": "16", "Length": "16", "Min": "0", "Max": "65535", "Resolution": "1", "Unit": "", "Description": "测量循环计数器（自传感器启动计数> 65535时0\n重新启动）" },
        { "Id": 1803, "Type": 0x60A, "Value": '', "Reference": '', "Sign": "Object_InterfaceVersion", "StartIndex": "28", "Length": "4", "Min": "0", "Max": "15", "Resolution": "1", "Unit": "", "Description": "Object 列表CAN 接口版本" },
        { "Id": 1901, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_ID", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "Object ID (由于目标是被跟踪的，所以ID在整个测量周期中都保持不变，而不必是连续的)" },
        { "Id": 1902, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_DistLong", "StartIndex": "19", "Length": "13", "Min": "-500", "Max": "1138.2", "Resolution": "0.2", "Unit": "m", "Description": "纵(x)坐标" },
        { "Id": 1903, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_DistLat", "StartIndex": "24", "Length": "11", "Min": "-204.6", "Max": "204.8", "Resolution": "0.2", "Unit": "m", "Description": "横向(y)坐标" },
        { "Id": 1904, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_VrelLong", "StartIndex": "46", "Length": "10", "Min": "-128.00", "Max": "127.75", "Resolution": "0.25", "Unit": "m/s", "Description": "纵向相对速度(x)" },
        { "Id": 1905, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_DynProp", "StartIndex": "48", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：移动\n0x1：静止\n0x2：来向\n0x3：可能静止\n0x4：未知\n0x5：横穿静止\n0x6：横穿移动\n0x7：停止", "Description": "物体的动态特性，指示物体是运动还是静止(只有正确给出速度和横摆角速度，才能正确确定该值)" },
        { "Id": 1906, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_VrelLat", "StartIndex": "53", "Length": "9", "Min": "-64.00", "Max": "63.75", "Resolution": "0.25", "Unit": "m/s", "Description": "横向相对速度(y)" },
        { "Id": 1907, "Type": 0x60B, "Value": '', "Reference": '', "Sign": "Object_RCS", "StartIndex": "56", "Length": "8", "Min": "-64.0", "Max": "63.5", "Resolution": "0.5", "Unit": "dBm2", "Description": "雷达散射截面积" },
        { "Id": 2001, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_ID", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "Object ID（由于目标是被跟踪的，所以ID在整个测量周期中都保持不变，而不必是连续的）" },
        { "Id": 2002, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_DistLong_rms", "StartIndex": "11", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "见表49", "Description": "纵向距离的标准差" },
        { "Id": 2003, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_VrelLong_rms", "StartIndex": "17", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "见表49", "Description": "纵向相对速度的标准差" },
        { "Id": 2004, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_DistLat_rms", "StartIndex": "22", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "见表49", "Description": "横向距离的标准差" },
        { "Id": 2005, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_VrelLat_rms", "StartIndex": "28", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "见表49", "Description": "横向相对速度的标准差" },
        { "Id": 2006, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_ArelLat_rms", "StartIndex": "34", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "见表49", "Description": "横向相对加速度的标准差" },
        { "Id": 2007, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_ArelLong_rms", "StartIndex": "39", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "见表49", "Description": "纵向相对加速度的标准差" },
        { "Id": 2008, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_Orientation_rms", "StartIndex": "45", "Length": "5", "Min": "0", "Max": "31", "Resolution": "1", "Unit": "deg", "Description": "方向角的标准差" },
        { "Id": 2009, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_MeasState", "StartIndex": "50", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：删除\n0x1：新的\n0x2：测量\n0x3：预测\n0x4：合并删除\n0x5：合并出新", "Description": "检测状态指示object是否有效并且已在新的测量周期中由clusters确认：\n0x0：删除Object-已删除Object在Object ID消失之前的最后一次传输周期中显示。\n0x1：创建新的Object –在创建Object ID后的第一个传输周期中显示。也可通Object_MeasCounter信息进行检查。\n0x2：测量-Object的创建已通过实际测量确认。可以创建Cluster。\n0x3：预测-实际测量无法确认Object创建。无法创建Cluster。\n0x4：融合删除-为了与另一个Object融合，而删除该Object\n0x5：合并出新-目标合并后创建了新Object。" },
        { "Id": 2010, "Type": 0x60C, "Value": '', "Reference": '', "Sign": "Obj_ProbOfExist", "StartIndex": "53", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：无效\n0x1：<25%\n0x2：<50%\n0x3：<75%\n0x4：<90%\n0x5：<99%\n0x6：<99.9%\n0x7：<=100%", "Description": "目标存在的可能性" },
        { "Id": 2101, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_ID", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "Object ID（由于目标是被跟踪的，所以ID在整个测量周期中都保持不变，而不必是连续的）" },
        { "Id": 2102, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_ArelLong", "StartIndex": "21", "Length": "11", "Min": "-10.00", "Max": "10.47", "Resolution": "0.01", "Unit": "m/s2", "Description": "纵向相对加速度" },
        { "Id": 2103, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_Class", "StartIndex": "24", "Length": "3", "Min": "0", "Max": "7", "Resolution": "1", "Unit": "0x0：点\n0x1：小汽车\n0x2：卡车\n0x3：行人\n0x4：摩托车\n0x5：自行车\n0x6：宽大的\n0x7：保留", "Description": "0x0：点\n0x1：小汽车\n0x2：卡车\n0x3：行人\n0x4：摩托车\n0x5：自行车\n0x6：宽广的\n0x7：保留" },
        { "Id": 2104, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_ArelLat", "StartIndex": "28", "Length": "9", "Min": "-2.50", "Max": "2.61", "Resolution": "0.01", "Unit": "m/s2", "Description": "横向相对加速度" },
        { "Id": 2105, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_OrientationAngel", "StartIndex": "46", "Length": "10", "Min": "-180.00", "Max": "180", "Resolution": "0.4", "Unit": "度", "Description": "目标的方向角" },
        { "Id": 2106, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_Length", "StartIndex": "48", "Length": "8", "Min": "0.0", "Max": "51.0", "Resolution": "0.2", "Unit": "m", "Description": "被跟踪对象的长度" },
        { "Id": 2107, "Type": 0x60D, "Value": '', "Reference": '', "Sign": "Object_Width", "StartIndex": "56", "Length": "8", "Min": "0.0", "Max": "51.0", "Resolution": "0.2", "Unit": "m", "Description": "被跟踪对象的宽度" },
        { "Id": 2201, "Type": 0x60E, "Value": '', "Reference": '', "Sign": "Object_ID", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "Object ID（由于目标是被跟踪的，所以ID在整个测量周期中都保持不变，而不必是连续的）" },
        { "Id": 2202, "Type": 0x60E, "Value": '', "Reference": '', "Sign": "Object_CollDetRegionBitfield", "StartIndex": "8", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "区域的字段，对于与此对象发生冲突的区域，将\n位设置1" },
        { "Id": 2301, "Type": 0x700, "Value": '', "Reference": '', "Sign": "Version_MajorRelease", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "软件主要版本" },
        { "Id": 2302, "Type": 0x700, "Value": '', "Reference": '', "Sign": "Version_MinorRelease", "StartIndex": "8", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "软件次要版本" },
        { "Id": 2303, "Type": 0x700, "Value": '', "Reference": '', "Sign": "Version_PatchLevel", "StartIndex": "16", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "", "Description": "软件补丁级别" },
        // { "Id": 2304, "Type": 0x700, "Value": '', "Reference": '', "Sign": "Version_ExtendedRange", "StartIndex": "25", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0 – 标准距离版本\n0x1 – 扩展距离版本，不会增加发射功率", "Description": "韩国/日本的版本降低为-3dB的功率输出" },
        // { "Id": 2305, "Type": 0x700, "Value": '', "Reference": '', "Sign": "Version_CountryCode", "StartIndex": "24", "Length": "1", "Min": "0", "Max": "1", "Resolution": "1", "Unit": "0x0 – 国际版\n0x1 – 韩国，日本-要求降低功率", "Description": "可以使用以下限制配置最大范围\nARS408：\n标准距离：96 – 260 m\n扩展距离：96 – 1200 m\nARS404：\n标准距离：150 – 190 m\n扩展距离：90 – 1000 m" },

        { "Id": 2401, "Type": 0x8, "Value": '', "Reference": '', "Sign": "CollDetRelayCtrl_Param", "StartIndex": "0", "Length": "8", "Min": "0", "Max": "255", "Resolution": "1", "Unit": "Bit 0： 继电器 1\nBit 1： 继电器 2\nBit 2： 继电器 3\nBit 3： 继电器 4\nBit 4： 保留\nBit 5： 保留\nBit 6： 保留\nBit 7： 保留", "Description": "模块上4个继电器的控制位" },
    ];

    public GraphConfigs: Array<ProtocolGraphConfig> = [
        { "Id": 1001, "Type": 0x201, "Index": 7, "Line": "2", "LT": "RadarState_NVMwriteStatus", "LB": "", "Color": "orange" },
        { "Id": 1002, "Type": 0x201, "Index": 6, "Line": "2", "LT": "RadarState_NVMReadStatus", "LB": "", "Color": "lime" },
        { "Id": 1003, "Type": 0x201, "Index": 5, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1004, "Type": 0x201, "Index": 4, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1005, "Type": 0x201, "Index": 3, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1006, "Type": 0x201, "Index": 2, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1007, "Type": 0x201, "Index": 1, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1008, "Type": 0x201, "Index": 0, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1009, "Type": 0x201, "Index": 15, "Line": "0", "LT": "RadarState_MaxDistanceCfg", "LB": "msb", "Color": "teal" },
        { "Id": 1010, "Type": 0x201, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1011, "Type": 0x201, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1012, "Type": 0x201, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1013, "Type": 0x201, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1014, "Type": 0x201, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1015, "Type": 0x201, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1016, "Type": 0x201, "Index": 8, "Line": "7", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1017, "Type": 0x201, "Index": 23, "Line": "3", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 1018, "Type": 0x201, "Index": 22, "Line": "8", "LT": "RadarState_MaxDistanceCfg", "LB": "lsb", "Color": "teal" },
        { "Id": 1019, "Type": 0x201, "Index": 21, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1020, "Type": 0x201, "Index": 20, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1021, "Type": 0x201, "Index": 19, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1022, "Type": 0x201, "Index": 18, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1023, "Type": 0x201, "Index": 17, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 1019, "Type": 0x201, "Index": 21, "Line": "2", "LT": "RadarState_Persistent_Error", "LB": "", "Color": "aquamarine" },
        // { "Id": 1020, "Type": 0x201, "Index": 20, "Line": "2", "LT": "RadarState_Interference", "LB": "", "Color": "chocolate" },
        // { "Id": 1021, "Type": 0x201, "Index": 19, "Line": "2", "LT": "RadarState_Temperature_Error", "LB": "", "Color": "cornflowerblue" },
        // { "Id": 1022, "Type": 0x201, "Index": 18, "Line": "2", "LT": "RadarState_Temporary_Error", "LB": "", "Color": "aqua" },
        // { "Id": 1023, "Type": 0x201, "Index": 17, "Line": "2", "LT": "RadarState_Voltage_Error", "LB": "", "Color": "chartreuse" },
        { "Id": 1024, "Type": 0x201, "Index": 16, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1025, "Type": 0x201, "Index": 31, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1026, "Type": 0x201, "Index": 30, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1027, "Type": 0x201, "Index": 29, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1028, "Type": 0x201, "Index": 28, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1029, "Type": 0x201, "Index": 27, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1030, "Type": 0x201, "Index": 26, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1031, "Type": 0x201, "Index": 25, "Line": "0", "LT": "RadarState_RadarPowerCfg", "LB": "msb", "Color": "hotpink" },
        { "Id": 1032, "Type": 0x201, "Index": 24, "Line": "7", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 1033, "Type": 0x201, "Index": 39, "Line": "5", "LT": "RadarState_RadarPowerCfg", "LB": "lsb", "Color": "hotpink" },
        { "Id": 1034, "Type": 0x201, "Index": 38, "Line": "0", "LT": "RadarState_SortIndex", "LB": "msb", "Color": "forestgreen" },
        { "Id": 1035, "Type": 0x201, "Index": 37, "Line": "6", "LT": "", "LB": "", "Color": "forestgreen" },
        { "Id": 1036, "Type": 0x201, "Index": 36, "Line": "8", "LT": "", "LB": "lsb", "Color": "forestgreen" },
        { "Id": 1037, "Type": 0x201, "Index": 35, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1038, "Type": 0x201, "Index": 34, "Line": "0", "LT": "RadarState_SensorID", "LB": "msb", "Color": "greenyellow" },
        { "Id": 1039, "Type": 0x201, "Index": 33, "Line": "6", "LT": "", "LB": "", "Color": "greenyellow" },
        { "Id": 1040, "Type": 0x201, "Index": 32, "Line": "8", "LT": "", "LB": "lsb", "Color": "greenyellow" },
        { "Id": 1041, "Type": 0x201, "Index": 47, "Line": "0", "LT": "RadarState_MotionRxState", "LB": "msb", "Color": "lightsalmon" },
        { "Id": 1042, "Type": 0x201, "Index": 46, "Line": "8", "LT": "", "LB": "lsb", "Color": "lightsalmon" },
        { "Id": 1043, "Type": 0x201, "Index": 45, "Line": "2", "LT": "RadarState_SendExtInfoCfg", "LB": "", "Color": "magenta" },
        { "Id": 1044, "Type": 0x201, "Index": 44, "Line": "2", "LT": "RadarState_SendQualityCfg", "LB": "", "Color": "lightgreen" },
        { "Id": 1045, "Type": 0x201, "Index": 43, "Line": "0", "LT": "RadarState_OutputTypeCfg", "LB": "msb", "Color": "limegreen" },
        { "Id": 1046, "Type": 0x201, "Index": 42, "Line": "8", "LT": "", "LB": "lsb", "Color": "limegreen" },
        { "Id": 1047, "Type": 0x201, "Index": 41, "Line": "2", "LT": "RadarState_CtrlRelayCfg", "LB": "", "Color": "lightseagreen" },
        { "Id": 1048, "Type": 0x201, "Index": 40, "Line": "", "LT": "", "LB": "", "Color": "" },

        { "Id": 1049, "Type": 0x201, "Index": 55, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1050, "Type": 0x201, "Index": 54, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1051, "Type": 0x201, "Index": 53, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1052, "Type": 0x201, "Index": 52, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1053, "Type": 0x201, "Index": 51, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1054, "Type": 0x201, "Index": 50, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1055, "Type": 0x201, "Index": 49, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1056, "Type": 0x201, "Index": 48, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 1049, "Type": 0x201, "Index": 55, "Line": "0", "LT": "RadarState_InvalidClusters", "LB": "msb", "Color": "mediumvioletred" },
        // { "Id": 1050, "Type": 0x201, "Index": 54, "Line": "6", "LT": "", "LB": "", "Color": "mediumvioletred" },
        // { "Id": 1051, "Type": 0x201, "Index": 53, "Line": "6", "LT": "", "LB": "", "Color": "mediumvioletred" },
        // { "Id": 1052, "Type": 0x201, "Index": 52, "Line": "6", "LT": "", "LB": "", "Color": "mediumvioletred" },
        // { "Id": 1053, "Type": 0x201, "Index": 51, "Line": "6", "LT": "", "LB": "", "Color": "mediumvioletred" },
        // { "Id": 1054, "Type": 0x201, "Index": 50, "Line": "6", "LT": "", "LB": "", "Color": "mediumvioletred" },
        // { "Id": 1055, "Type": 0x201, "Index": 49, "Line": "6", "LT": "", "LB": "", "Color": "mediumvioletred" },
        // { "Id": 1056, "Type": 0x201, "Index": 48, "Line": "8", "LT": "", "LB": "lsb", "Color": "mediumvioletred" },
        { "Id": 1057, "Type": 0x201, "Index": 63, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1058, "Type": 0x201, "Index": 62, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1059, "Type": 0x201, "Index": 61, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1060, "Type": 0x201, "Index": 60, "Line": "0", "LT": "RadarState_RCS_Threshold", "LB": "msb", "Color": "navajowhite" },
        { "Id": 1061, "Type": 0x201, "Index": 59, "Line": "6", "LT": "", "LB": "", "Color": "navajowhite" },
        { "Id": 1062, "Type": 0x201, "Index": 58, "Line": "8", "LT": "", "LB": "lsb", "Color": "navajowhite" },
        { "Id": 1063, "Type": 0x201, "Index": 57, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 1064, "Type": 0x201, "Index": 56, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 4001, "Type": 0x408, "Index": 7, "Line": "0", "LT": "CollDetState_NofRegions", "LB": "msb", "Color": "lime" },
        { "Id": 4002, "Type": 0x408, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "lime" },
        { "Id": 4003, "Type": 0x408, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "lime" },
        { "Id": 4004, "Type": 0x408, "Index": 4, "Line": "8", "LT": "", "LB": "lsb", "Color": "lime" },
        { "Id": 4005, "Type": 0x408, "Index": 3, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 4006, "Type": 0x408, "Index": 2, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 4007, "Type": 0x408, "Index": 1, "Line": "2", "LT": "CollDetState_Activation", "LB": "", "Color": "green" },
        { "Id": 4008, "Type": 0x408, "Index": 0, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 4009, "Type": 0x408, "Index": 15, "Line": "0", "LT": "CollDetState_MinDetectTime", "LB": "msb", "Color": "teal" },
        { "Id": 4010, "Type": 0x408, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 4011, "Type": 0x408, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 4012, "Type": 0x408, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 4013, "Type": 0x408, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 4014, "Type": 0x408, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 4015, "Type": 0x408, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "teal" },
        { "Id": 4016, "Type": 0x408, "Index": 8, "Line": "8", "LT": "", "LB": "lsb", "Color": "teal" },
        { "Id": 4017, "Type": 0x408, "Index": 23, "Line": "0", "LT": "CollDetState_MeasCounter", "LB": "msb", "Color": "hotpink" },
        { "Id": 4018, "Type": 0x408, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4019, "Type": 0x408, "Index": 21, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4020, "Type": 0x408, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4021, "Type": 0x408, "Index": 19, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4022, "Type": 0x408, "Index": 18, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4023, "Type": 0x408, "Index": 17, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4024, "Type": 0x408, "Index": 16, "Line": "7", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4025, "Type": 0x408, "Index": 31, "Line": "3", "LT": "CollDetState_MeasCounter", "LB": "", "Color": "hotpink" },
        { "Id": 4026, "Type": 0x408, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4027, "Type": 0x408, "Index": 29, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4028, "Type": 0x408, "Index": 28, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4029, "Type": 0x408, "Index": 27, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4030, "Type": 0x408, "Index": 26, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4031, "Type": 0x408, "Index": 25, "Line": "6", "LT": "", "LB": "", "Color": "hotpink" },
        { "Id": 4032, "Type": 0x408, "Index": 24, "Line": "8", "LT": "", "LB": "lsb", "Color": "hotpink" },
        { "Id": 5001, "Type": 0x402, "Index": 7, "Line": "0", "LT": "CollDetRegState_RegionID", "LB": "msb", "Color": "#84ff42" },
        { "Id": 5002, "Type": 0x402, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 5003, "Type": 0x402, "Index": 5, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84ff42" },
        { "Id": 5004, "Type": 0x402, "Index": 4, "Line": "0", "LT": "CollDetRegState_WarningLevel", "LB": "msb", "Color": "#ff8442" },
        { "Id": 5005, "Type": 0x402, "Index": 3, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff8442" },
        { "Id": 5006, "Type": 0x402, "Index": 2, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 5007, "Type": 0x402, "Index": 1, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 5008, "Type": 0x402, "Index": 0, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 5009, "Type": 0x402, "Index": 15, "Line": "0", "LT": "CollDetRegState_Point1X", "LB": "msb", "Color": "#4284c4" },
        { "Id": 5010, "Type": 0x402, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5011, "Type": 0x402, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5012, "Type": 0x402, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5013, "Type": 0x402, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5014, "Type": 0x402, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5015, "Type": 0x402, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5016, "Type": 0x402, "Index": 8, "Line": "7", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5017, "Type": 0x402, "Index": 23, "Line": "3", "LT": "CollDetRegState_Point1X", "LB": "", "Color": "#4284c4" },
        { "Id": 5018, "Type": 0x402, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5019, "Type": 0x402, "Index": 21, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5020, "Type": 0x402, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 5021, "Type": 0x402, "Index": 19, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        { "Id": 5022, "Type": 0x402, "Index": 18, "Line": "0", "LT": "CollDetRegState_Point1Y", "LB": "msb", "Color": "#ffc484" },
        { "Id": 5023, "Type": 0x402, "Index": 17, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5024, "Type": 0x402, "Index": 16, "Line": "7", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5025, "Type": 0x402, "Index": 31, "Line": "3", "LT": "CollDetRegState_Point1Y", "LB": "", "Color": "#ffc484" },
        { "Id": 5026, "Type": 0x402, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5027, "Type": 0x402, "Index": 29, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5028, "Type": 0x402, "Index": 28, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5029, "Type": 0x402, "Index": 27, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5030, "Type": 0x402, "Index": 26, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5031, "Type": 0x402, "Index": 25, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 5032, "Type": 0x402, "Index": 24, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 5033, "Type": 0x402, "Index": 39, "Line": "0", "LT": "CollDetRegState_Point2X", "LB": "msb", "Color": "#42ff84" },
        { "Id": 5034, "Type": 0x402, "Index": 38, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5035, "Type": 0x402, "Index": 37, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5036, "Type": 0x402, "Index": 36, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5037, "Type": 0x402, "Index": 35, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5038, "Type": 0x402, "Index": 34, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5039, "Type": 0x402, "Index": 33, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5040, "Type": 0x402, "Index": 32, "Line": "7", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5041, "Type": 0x402, "Index": 47, "Line": "3", "LT": "CollDetRegState_Point2X", "LB": "", "Color": "#42ff84" },
        { "Id": 5042, "Type": 0x402, "Index": 46, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5043, "Type": 0x402, "Index": 45, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5044, "Type": 0x402, "Index": 44, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 5045, "Type": 0x402, "Index": 43, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 5046, "Type": 0x402, "Index": 42, "Line": "0", "LT": "CollDetRegState_Point2Y", "LB": "msb", "Color": "#ff84c4" },
        { "Id": 5047, "Type": 0x402, "Index": 41, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5048, "Type": 0x402, "Index": 40, "Line": "7", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5049, "Type": 0x402, "Index": 55, "Line": "3", "LT": "CollDetRegState_Point2Y", "LB": "", "Color": "#ff84c4" },
        { "Id": 5050, "Type": 0x402, "Index": 54, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5051, "Type": 0x402, "Index": 53, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5052, "Type": 0x402, "Index": 52, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5053, "Type": 0x402, "Index": 51, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5054, "Type": 0x402, "Index": 50, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5055, "Type": 0x402, "Index": 49, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 5056, "Type": 0x402, "Index": 48, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff84c4" },
        { "Id": 5057, "Type": 0x402, "Index": 63, "Line": "0", "LT": "CollDetRegState_NofObjects", "LB": "msb", "Color": "#84c442" },
        { "Id": 5058, "Type": 0x402, "Index": 62, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 5059, "Type": 0x402, "Index": 61, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 5060, "Type": 0x402, "Index": 60, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 5061, "Type": 0x402, "Index": 59, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 5062, "Type": 0x402, "Index": 58, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 5063, "Type": 0x402, "Index": 57, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 5064, "Type": 0x402, "Index": 56, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84c442" },
        { "Id": 6001, "Type": 0x700, "Index": 7, "Line": "0", "LT": "Version_MajorRelease", "LB": "msb", "Color": "#42ff84" },
        { "Id": 6002, "Type": 0x700, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 6003, "Type": 0x700, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 6004, "Type": 0x700, "Index": 4, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 6005, "Type": 0x700, "Index": 3, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 6006, "Type": 0x700, "Index": 2, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 6007, "Type": 0x700, "Index": 1, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 6008, "Type": 0x700, "Index": 0, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 6009, "Type": 0x700, "Index": 15, "Line": "0", "LT": "Version_MinorRelease", "LB": "msb", "Color": "#ffc484" },
        { "Id": 6010, "Type": 0x700, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 6011, "Type": 0x700, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 6012, "Type": 0x700, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 6013, "Type": 0x700, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 6014, "Type": 0x700, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 6015, "Type": 0x700, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 6016, "Type": 0x700, "Index": 8, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 6017, "Type": 0x700, "Index": 23, "Line": "0", "LT": "Version_PatchLevel", "LB": "msb", "Color": "#4284c4" },
        { "Id": 6018, "Type": 0x700, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 6019, "Type": 0x700, "Index": 21, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 6020, "Type": 0x700, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 6021, "Type": 0x700, "Index": 19, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 6022, "Type": 0x700, "Index": 18, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 6023, "Type": 0x700, "Index": 17, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 6024, "Type": 0x700, "Index": 16, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        // { "Id": 6025, "Type": 0x700, "Index": 31, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6026, "Type": 0x700, "Index": 30, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6027, "Type": 0x700, "Index": 29, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6028, "Type": 0x700, "Index": 28, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6029, "Type": 0x700, "Index": 27, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6030, "Type": 0x700, "Index": 26, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6031, "Type": 0x700, "Index": 25, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6032, "Type": 0x700, "Index": 24, "Line": "", "LT": "", "LB": "", "Color": "" },
        // { "Id": 6031, "Type": 0x700, "Index": 25, "Line": "2", "LT": "Version_ExtendedRange", "LB": "", "Color": "#84ff42" },
        // { "Id": 6032, "Type": 0x700, "Index": 24, "Line": "2", "LT": "Version_CountryCode", "LB": "", "Color": "#ff84c4" },
        { "Id": 7001, "Type": 0x60A, "Index": 7, "Line": "0", "LT": "Object_NofObjects", "LB": "msb", "Color": "#42ff84" },
        { "Id": 7002, "Type": 0x60A, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 7003, "Type": 0x60A, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 7004, "Type": 0x60A, "Index": 4, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 7005, "Type": 0x60A, "Index": 3, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 7006, "Type": 0x60A, "Index": 2, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 7007, "Type": 0x60A, "Index": 1, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 7008, "Type": 0x60A, "Index": 0, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 7009, "Type": 0x60A, "Index": 15, "Line": "0", "LT": "Object_MeasCounter", "LB": "msb", "Color": "#ffc484" },
        { "Id": 7010, "Type": 0x60A, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7011, "Type": 0x60A, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7012, "Type": 0x60A, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7013, "Type": 0x60A, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7014, "Type": 0x60A, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7015, "Type": 0x60A, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7016, "Type": 0x60A, "Index": 8, "Line": "7", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7017, "Type": 0x60A, "Index": 23, "Line": "3", "LT": "Object_MeasCounter", "LB": "", "Color": "#ffc484" },
        { "Id": 7018, "Type": 0x60A, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7019, "Type": 0x60A, "Index": 21, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7020, "Type": 0x60A, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7021, "Type": 0x60A, "Index": 19, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7022, "Type": 0x60A, "Index": 18, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7023, "Type": 0x60A, "Index": 17, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 7024, "Type": 0x60A, "Index": 16, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 7025, "Type": 0x60A, "Index": 31, "Line": "0", "LT": "Object_InterfaceVersion", "LB": "msb", "Color": "#4284c4" },
        { "Id": 7026, "Type": 0x60A, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 7027, "Type": 0x60A, "Index": 29, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 7028, "Type": 0x60A, "Index": 28, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        { "Id": 7029, "Type": 0x60A, "Index": 27, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 7030, "Type": 0x60A, "Index": 26, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 7031, "Type": 0x60A, "Index": 25, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 7032, "Type": 0x60A, "Index": 24, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 8001, "Type": 0x60B, "Index": 7, "Line": "0", "LT": "Object_ID", "LB": "msb", "Color": "#ff84c4" },
        { "Id": 8002, "Type": 0x60B, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 8003, "Type": 0x60B, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 8004, "Type": 0x60B, "Index": 4, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 8005, "Type": 0x60B, "Index": 3, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 8006, "Type": 0x60B, "Index": 2, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 8007, "Type": 0x60B, "Index": 1, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 8008, "Type": 0x60B, "Index": 0, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff84c4" },
        { "Id": 8009, "Type": 0x60B, "Index": 15, "Line": "0", "LT": "Object_DistLong", "LB": "msb", "Color": "#42ff84" },
        { "Id": 8010, "Type": 0x60B, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8011, "Type": 0x60B, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8012, "Type": 0x60B, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8013, "Type": 0x60B, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8014, "Type": 0x60B, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8015, "Type": 0x60B, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8016, "Type": 0x60B, "Index": 8, "Line": "7", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8017, "Type": 0x60B, "Index": 23, "Line": "3", "LT": "Object_DistLong", "LB": "", "Color": "#42ff84" },
        { "Id": 8018, "Type": 0x60B, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8019, "Type": 0x60B, "Index": 21, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8020, "Type": 0x60B, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 8021, "Type": 0x60B, "Index": 19, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 8022, "Type": 0x60B, "Index": 18, "Line": "0", "LT": "Object_DistLat", "LB": "msb", "Color": "#4284c4" },
        { "Id": 8023, "Type": 0x60B, "Index": 17, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8024, "Type": 0x60B, "Index": 16, "Line": "7", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8025, "Type": 0x60B, "Index": 31, "Line": "3", "LT": "Object_DistLat", "LB": "", "Color": "#4284c4" },
        { "Id": 8026, "Type": 0x60B, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8027, "Type": 0x60B, "Index": 29, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8028, "Type": 0x60B, "Index": 28, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8029, "Type": 0x60B, "Index": 27, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8030, "Type": 0x60B, "Index": 26, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8031, "Type": 0x60B, "Index": 25, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 8032, "Type": 0x60B, "Index": 24, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        { "Id": 8033, "Type": 0x60B, "Index": 39, "Line": "0", "LT": "Object_VrelLong", "LB": "msb", "Color": "#ffc484" },
        { "Id": 8034, "Type": 0x60B, "Index": 38, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8035, "Type": 0x60B, "Index": 37, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8036, "Type": 0x60B, "Index": 36, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8037, "Type": 0x60B, "Index": 35, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8038, "Type": 0x60B, "Index": 34, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8039, "Type": 0x60B, "Index": 33, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8040, "Type": 0x60B, "Index": 32, "Line": "7", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 8041, "Type": 0x60B, "Index": 47, "Line": "3", "LT": "Object_VrelLong", "LB": "", "Color": "#ffc484" },
        { "Id": 8042, "Type": 0x60B, "Index": 46, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 8043, "Type": 0x60B, "Index": 45, "Line": "0", "LT": "Object_VrelLat", "LB": "msb", "Color": "#84ff42" },
        { "Id": 8044, "Type": 0x60B, "Index": 44, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 8045, "Type": 0x60B, "Index": 43, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 8046, "Type": 0x60B, "Index": 42, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 8047, "Type": 0x60B, "Index": 41, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 8048, "Type": 0x60B, "Index": 40, "Line": "7", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 8049, "Type": 0x60B, "Index": 55, "Line": "3", "LT": "Object_VrelLat", "LB": "", "Color": "#84ff42" },
        { "Id": 8050, "Type": 0x60B, "Index": 54, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 8051, "Type": 0x60B, "Index": 53, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84ff42" },
        { "Id": 8052, "Type": 0x60B, "Index": 52, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 8053, "Type": 0x60B, "Index": 51, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 8054, "Type": 0x60B, "Index": 50, "Line": "0", "LT": "Object_DynProp", "LB": "msb", "Color": "#ff8442" },
        { "Id": 8055, "Type": 0x60B, "Index": 49, "Line": "6", "LT": "", "LB": "", "Color": "#ff8442" },
        { "Id": 8056, "Type": 0x60B, "Index": 48, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff8442" },
        { "Id": 8057, "Type": 0x60B, "Index": 63, "Line": "0", "LT": "Object_RCS", "LB": "msb", "Color": "#84c442" },
        { "Id": 8058, "Type": 0x60B, "Index": 62, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 8059, "Type": 0x60B, "Index": 61, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 8060, "Type": 0x60B, "Index": 60, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 8061, "Type": 0x60B, "Index": 59, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 8062, "Type": 0x60B, "Index": 58, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 8063, "Type": 0x60B, "Index": 57, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 8064, "Type": 0x60B, "Index": 56, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84c442" },
        { "Id": 9001, "Type": 0x60C, "Index": 7, "Line": "0", "LT": "Obj_ID", "LB": "msb", "Color": "#4284c4" },
        { "Id": 9002, "Type": 0x60C, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 9003, "Type": 0x60C, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 9004, "Type": 0x60C, "Index": 4, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 9005, "Type": 0x60C, "Index": 3, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 9006, "Type": 0x60C, "Index": 2, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 9007, "Type": 0x60C, "Index": 1, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 9008, "Type": 0x60C, "Index": 0, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        { "Id": 9009, "Type": 0x60C, "Index": 15, "Line": "0", "LT": "Obj_DistLong_rms", "LB": "msb", "Color": "#42ff84" },
        { "Id": 9010, "Type": 0x60C, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 9011, "Type": 0x60C, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 9012, "Type": 0x60C, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 9013, "Type": 0x60C, "Index": 11, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 9014, "Type": 0x60C, "Index": 10, "Line": "0", "LT": "Obj_DistLat_rms", "LB": "msb", "Color": "#ffc484" },
        { "Id": 9015, "Type": 0x60C, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 9016, "Type": 0x60C, "Index": 8, "Line": "7", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 9017, "Type": 0x60C, "Index": 23, "Line": "3", "LT": "Obj_DistLat_rms", "LB": "", "Color": "#ffc484" },
        { "Id": 9018, "Type": 0x60C, "Index": 22, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 9019, "Type": 0x60C, "Index": 21, "Line": "0", "LT": "Obj_VrelLong_rms", "LB": "msb", "Color": "#84c442" },
        { "Id": 9020, "Type": 0x60C, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 9021, "Type": 0x60C, "Index": 19, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 9022, "Type": 0x60C, "Index": 18, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 9023, "Type": 0x60C, "Index": 17, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84c442" },
        { "Id": 9024, "Type": 0x60C, "Index": 16, "Line": "1", "LT": "Obj_VrelLat_rms", "LB": "msb", "Color": "#84ff42" },
        { "Id": 9025, "Type": 0x60C, "Index": 31, "Line": "7", "LT": "Obj_VrelLat_rms", "LB": "", "Color": "#84ff42" },
        { "Id": 9026, "Type": 0x60C, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 9027, "Type": 0x60C, "Index": 29, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 9028, "Type": 0x60C, "Index": 28, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84ff42" },
        { "Id": 9029, "Type": 0x60C, "Index": 27, "Line": "0", "LT": "Obj_ArelLong_rms", "LB": "msb", "Color": "#c44284" },
        { "Id": 9030, "Type": 0x60C, "Index": 26, "Line": "6", "LT": "", "LB": "", "Color": "#c44284" },
        { "Id": 9031, "Type": 0x60C, "Index": 25, "Line": "6", "LT": "", "LB": "", "Color": "#c44284" },
        { "Id": 9032, "Type": 0x60C, "Index": 24, "Line": "3", "LT": "", "LB": "", "Color": "#c44284" },
        { "Id": 9033, "Type": 0x60C, "Index": 39, "Line": "5", "LT": "Obj_ArelLong_rms", "LB": "lsb", "Color": "#c44284" },
        { "Id": 9034, "Type": 0x60C, "Index": 38, "Line": "0", "LT": "Obj_ArelLat_rms", "LB": "msb", "Color": "#ff8442" },
        { "Id": 9035, "Type": 0x60C, "Index": 37, "Line": "6", "LT": "", "LB": "", "Color": "#ff8442" },
        { "Id": 9036, "Type": 0x60C, "Index": 36, "Line": "6", "LT": "", "LB": "", "Color": "#ff8442" },
        { "Id": 9037, "Type": 0x60C, "Index": 35, "Line": "6", "LT": "", "LB": "", "Color": "#ff8442" },
        { "Id": 9038, "Type": 0x60C, "Index": 34, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff8442" },
        { "Id": 9039, "Type": 0x60C, "Index": 33, "Line": "0", "LT": "Obj_Orientation_rms", "LB": "msb", "Color": "#ff84c4" },
        { "Id": 9040, "Type": 0x60C, "Index": 32, "Line": "7", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 9041, "Type": 0x60C, "Index": 47, "Line": "3", "LT": "Obj_Orientation_rms", "LB": "", "Color": "#ff84c4" },
        { "Id": 9042, "Type": 0x60C, "Index": 46, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 9043, "Type": 0x60C, "Index": 45, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff84c4" },
        { "Id": 9044, "Type": 0x60C, "Index": 44, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 9045, "Type": 0x60C, "Index": 43, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 9046, "Type": 0x60C, "Index": 42, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 9047, "Type": 0x60C, "Index": 41, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 9048, "Type": 0x60C, "Index": 40, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 9049, "Type": 0x60C, "Index": 55, "Line": "0", "LT": "Obj_ProbOfExist", "LB": "msb", "Color": "#42c4ff" },
        { "Id": 9050, "Type": 0x60C, "Index": 54, "Line": "6", "LT": "", "LB": "", "Color": "#42c4ff" },
        { "Id": 9051, "Type": 0x60C, "Index": 53, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42c4ff" },
        { "Id": 9052, "Type": 0x60C, "Index": 52, "Line": "0", "LT": "Obj_MeasState", "LB": "msb", "Color": "#c4ff84" },
        { "Id": 9053, "Type": 0x60C, "Index": 51, "Line": "6", "LT": "", "LB": "", "Color": "#c4ff84" },
        { "Id": 9054, "Type": 0x60C, "Index": 50, "Line": "8", "LT": "", "LB": "lsb", "Color": "#c4ff84" },
        { "Id": 9055, "Type": 0x60C, "Index": 49, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 9056, "Type": 0x60C, "Index": 48, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10001, "Type": 0x60D, "Index": 7, "Line": "0", "LT": "Object_ID", "LB": "msb", "Color": "#84ff42" },
        { "Id": 10002, "Type": 0x60D, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 10003, "Type": 0x60D, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 10004, "Type": 0x60D, "Index": 4, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 10005, "Type": 0x60D, "Index": 3, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 10006, "Type": 0x60D, "Index": 2, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 10007, "Type": 0x60D, "Index": 1, "Line": "6", "LT": "", "LB": "", "Color": "#84ff42" },
        { "Id": 10008, "Type": 0x60D, "Index": 0, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84ff42" },
        { "Id": 10009, "Type": 0x60D, "Index": 15, "Line": "0", "LT": "Object_ArelLong", "LB": "msb", "Color": "#4284c4" },
        { "Id": 10010, "Type": 0x60D, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10011, "Type": 0x60D, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10012, "Type": 0x60D, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10013, "Type": 0x60D, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10014, "Type": 0x60D, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10015, "Type": 0x60D, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10016, "Type": 0x60D, "Index": 8, "Line": "7", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10017, "Type": 0x60D, "Index": 23, "Line": "3", "LT": "Object_ArelLong", "LB": "", "Color": "#4284c4" },
        { "Id": 10018, "Type": 0x60D, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 10019, "Type": 0x60D, "Index": 21, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        { "Id": 10020, "Type": 0x60D, "Index": 20, "Line": "0", "LT": "Object_ArelLat", "LB": "msb", "Color": "#84c442" },
        { "Id": 10021, "Type": 0x60D, "Index": 19, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 10022, "Type": 0x60D, "Index": 18, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 10023, "Type": 0x60D, "Index": 17, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 10024, "Type": 0x60D, "Index": 16, "Line": "7", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 10025, "Type": 0x60D, "Index": 31, "Line": "3", "LT": "Object_ArelLat", "LB": "", "Color": "#84c442" },
        { "Id": 10026, "Type": 0x60D, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 10027, "Type": 0x60D, "Index": 29, "Line": "6", "LT": "", "LB": "", "Color": "#84c442" },
        { "Id": 10028, "Type": 0x60D, "Index": 28, "Line": "8", "LT": "", "LB": "lsb", "Color": "#84c442" },
        { "Id": 10029, "Type": 0x60D, "Index": 27, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10030, "Type": 0x60D, "Index": 26, "Line": "0", "LT": "Object_Class", "LB": "msb", "Color": "#ff8442" },
        { "Id": 10031, "Type": 0x60D, "Index": 25, "Line": "6", "LT": "", "LB": "", "Color": "#ff8442" },
        { "Id": 10032, "Type": 0x60D, "Index": 24, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff8442" },
        { "Id": 10033, "Type": 0x60D, "Index": 39, "Line": "0", "LT": "Object_OrientationAngel", "LB": "msb", "Color": "#ff84c4" },
        { "Id": 10034, "Type": 0x60D, "Index": 38, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10035, "Type": 0x60D, "Index": 37, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10036, "Type": 0x60D, "Index": 36, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10037, "Type": 0x60D, "Index": 35, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10038, "Type": 0x60D, "Index": 34, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10039, "Type": 0x60D, "Index": 33, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10040, "Type": 0x60D, "Index": 32, "Line": "3", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 10041, "Type": 0x60D, "Index": 47, "Line": "7", "LT": "Object_OrientationAngel", "LB": "", "Color": "#ff84c4" },
        { "Id": 10042, "Type": 0x60D, "Index": 46, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff84c4" },
        { "Id": 10043, "Type": 0x60D, "Index": 45, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10044, "Type": 0x60D, "Index": 44, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10045, "Type": 0x60D, "Index": 43, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10046, "Type": 0x60D, "Index": 42, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10047, "Type": 0x60D, "Index": 41, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10048, "Type": 0x60D, "Index": 40, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 10049, "Type": 0x60D, "Index": 55, "Line": "0", "LT": "Object_Length", "LB": "msb", "Color": "#ffc484" },
        { "Id": 10050, "Type": 0x60D, "Index": 54, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 10051, "Type": 0x60D, "Index": 53, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 10052, "Type": 0x60D, "Index": 52, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 10053, "Type": 0x60D, "Index": 51, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 10054, "Type": 0x60D, "Index": 50, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 10055, "Type": 0x60D, "Index": 49, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 10056, "Type": 0x60D, "Index": 48, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 10057, "Type": 0x60D, "Index": 63, "Line": "0", "LT": "Object_Width", "LB": "msb", "Color": "#42ff84" },
        { "Id": 10058, "Type": 0x60D, "Index": 62, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 10059, "Type": 0x60D, "Index": 61, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 10060, "Type": 0x60D, "Index": 60, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 10061, "Type": 0x60D, "Index": 59, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 10062, "Type": 0x60D, "Index": 58, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 10063, "Type": 0x60D, "Index": 57, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 10064, "Type": 0x60D, "Index": 56, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 11001, "Type": 0x60E, "Index": 7, "Line": "0", "LT": "Object_ID", "LB": "msb", "Color": "#4284c4" },
        { "Id": 11002, "Type": 0x60E, "Index": 6, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 11003, "Type": 0x60E, "Index": 5, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 11004, "Type": 0x60E, "Index": 4, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 11005, "Type": 0x60E, "Index": 3, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 11006, "Type": 0x60E, "Index": 2, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 11007, "Type": 0x60E, "Index": 1, "Line": "6", "LT": "", "LB": "", "Color": "#4284c4" },
        { "Id": 11008, "Type": 0x60E, "Index": 0, "Line": "8", "LT": "", "LB": "lsb", "Color": "#4284c4" },
        { "Id": 11009, "Type": 0x60E, "Index": 15, "Line": "0", "LT": "Object_CollDetRegionBitfield", "LB": "msb", "Color": "#ffc484" },
        { "Id": 11010, "Type": 0x60E, "Index": 14, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 11011, "Type": 0x60E, "Index": 13, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 11012, "Type": 0x60E, "Index": 12, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 11013, "Type": 0x60E, "Index": 11, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 11014, "Type": 0x60E, "Index": 10, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 11015, "Type": 0x60E, "Index": 9, "Line": "6", "LT": "", "LB": "", "Color": "#ffc484" },
        { "Id": 11016, "Type": 0x60E, "Index": 8, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ffc484" },
        { "Id": 11017, "Type": 0x60E, "Index": 23, "Line": "0", "LT": "Reserved", "LB": "msb", "Color": "#42ff84" },
        { "Id": 11018, "Type": 0x60E, "Index": 22, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 11019, "Type": 0x60E, "Index": 21, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 11020, "Type": 0x60E, "Index": 20, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 11021, "Type": 0x60E, "Index": 19, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 11022, "Type": 0x60E, "Index": 18, "Line": "6", "LT": "", "LB": "", "Color": "#42ff84" },
        { "Id": 11023, "Type": 0x60E, "Index": 17, "Line": "8", "LT": "", "LB": "lsb", "Color": "#42ff84" },
        { "Id": 11024, "Type": 0x60E, "Index": 16, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 11025, "Type": 0x60E, "Index": 31, "Line": "0", "LT": "Reserved", "LB": "msb", "Color": "#ff84c4" },
        { "Id": 11026, "Type": 0x60E, "Index": 30, "Line": "6", "LT": "", "LB": "", "Color": "#ff84c4" },
        { "Id": 11027, "Type": 0x60E, "Index": 29, "Line": "8", "LT": "", "LB": "lsb", "Color": "#ff84c4" },
        { "Id": 11028, "Type": 0x60E, "Index": 28, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 11029, "Type": 0x60E, "Index": 27, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 11030, "Type": 0x60E, "Index": 26, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 11031, "Type": 0x60E, "Index": 25, "Line": "", "LT": "", "LB": "", "Color": "" },
        { "Id": 11032, "Type": 0x60E, "Index": 24, "Line": "", "LT": "", "LB": "", "Color": "" },
    ];

    public TypeMap: Map<number, string> = new Map([
        [-1, '无'],
        [0, '全部'],
        [0x201, '0x201'],
        [0x402, '0x402'],
        [0x408, '0x408'],
        [0x700, '0x700'],
        [0x60A, '0x60A'],
        [0x60B, '0x60B'],
        [0x60C, '0x60C'],
        [0x60D, '0x60D'],
        [0x60E, '0x60E'],
    ]);

    public Capacity: number = 64;

    /**
     * 协议类型
     */
    public Type: Ref<number> = ref(-1);

    public Datas: UnwrapNestedRefs<Array<ClientMessage.MillimeterWaveRadarProtocolData>> = reactive([]);

    public DataType: Ref<number> = ref(-1);
    public DataBits: Ref<Array<number>> = ref([]);

    public DocumentUrl: Ref<string> = ref('/static/MMWR/协议解析.pdf');

    public ShowDocument: Ref<boolean> = ref(false);
    public ShowTool: Ref<boolean> = ref(false);
    

    public DataSource: Ref<string> = ref('Device');

    public SimulatedData: Array<ClientMessage.MillimeterWaveRadarProtocolData> = [
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0x0B, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x0B, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x0F, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0x25, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x3F, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0x41, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x41, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x5B, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0x5B, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x5D, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x75, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0x77, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x77, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x79, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x8F, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0x91, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x91, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0x93, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0xAD, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0xAD, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0xAF, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0x32, 0xC5, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x02, 0x64, 0x32, 0xC7, 0x00, 0x00, 0x00, 0x00]),

        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x00, 0x20, 0x08, 0x00, 0x04]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x201, [0x40, 0x19, 0x00, 0x01, 0x00, 0x18, 0x00, 0x04]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x402, [0x00, 0x46, 0x53, 0xFE, 0x55, 0xF7, 0xE7, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x12, 0x64, 0xC4, 0x69, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x12, 0x64, 0xC5, 0x41, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x12, 0x64, 0xC5, 0x91, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x12, 0x64, 0xC5, 0xC7, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x408, [0x12, 0x64, 0xC6, 0xD3, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x700, [0x04, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x03, 0xD4, 0x97, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x00, 0xD6, 0xB7, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60A, [0x01, 0xD9, 0x61, 0x10, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60B, [0x05, 0x4F, 0x9B, 0xF5, 0x80, 0x20, 0x01, 0x71]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60B, [0x00, 0x4E, 0x94, 0x00, 0x80, 0x20, 0x01, 0x84]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60C, [0x04, 0x8C, 0xA5, 0x3A, 0x02, 0x20, 0xE8, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60C, [0x01, 0x84, 0xA3, 0x3A, 0x02, 0x20, 0xE8, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60C, [0x07, 0x9C, 0xE7, 0x7C, 0x02, 0x20, 0xE8, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60C, [0x04, 0x9D, 0x2B, 0x7C, 0x82, 0x20, 0xAC, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60C, [0x00, 0xA5, 0x27, 0x8D, 0x82, 0x20, 0x64, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60D, [0x01, 0x7D, 0x4F, 0xA1, 0x70, 0x80, 0x0A, 0x0C]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60D, [0x04, 0x7C, 0xEF, 0xA0, 0x70, 0x80, 0x05, 0x05]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60D, [0x07, 0x7D, 0xAF, 0xA0, 0x70, 0x80, 0x05, 0x05]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60D, [0x07, 0x7C, 0x0F, 0xA0, 0x70, 0x80, 0x05, 0x05]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60E, [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60E, [0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
        new ClientMessage.MillimeterWaveRadarProtocolData(0x60E, [0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
    ];

    public FormattedData: Ref<string> = ref('');
   
    public showReferences = ref(false);
    public showResults = ref(false);
    private watchStopHandles: Array<WatchStopHandle> = [];

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetBlackBackground();
        TooltipComponent.Default.Clear();

        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();
        this.Type.value = -1;
        lock.Dispose();
    }

    public Receive(datas: Array<ClientMessage.MillimeterWaveRadarProtocolData>): void {
        if (this.DataSource.value == 'Simulate') {
            return;
        }

        const count = this.Datas.length + datas.length - this.Capacity;
        this.Datas.removeAt(0, count);
        this.Datas.addRange(datas);
    }

    private OnDataSourceChanged(): void {
        if (this.DataSource.value == 'Device') {
            this.OnDataSourceChangedToDevice();
        } else {
            this.OnDataSourceChangedToSimulation();
        }
    }

    private OnDataSourceChangedToDevice(): void {
        this.Datas.clear();
    }

    private OnDataSourceChangedToSimulation(): void {
        this.Datas.clear();
        this.Datas.addRange(this.SimulatedData.filter(data => this.Type.value == 0 || data.Id == this.Type.value));
    }
    public HiddenDomain = ref(false)
    public Resolve(data: ClientMessage.MillimeterWaveRadarProtocolData): void {
        this.HiddenDomain.value = !this.HiddenDomain.value
        this.DefinitionConfigs.forEach((item)=>{
            item.Value = ''
        })
        this.showReferences.value = false;
        this.showResults.value = false;
        this.DataBits.value.clear();
        for (const byte of data.Data) {
            this.DataBits.value.addRange(Array.from(byte.toString(2).padStart(8, '0')).reverse().map(char => Number.parseInt(char)));
        }
        this.FormattedData.value = `0x${data.Id.toString(16).padStart(3, '0').toUpperCase()} - ` + data.Data.map(byte => byte.toString(16).padStart(2, '0').toUpperCase()).join(' ');
        this.DataType.value = data.Id;

        // CAN信号解析
        function ResolveSingalValue(start: number, length: number, data: Array<number>): number {
            let merge = 0;
            let value = 0;

            const lsbBit = start & 7;
            const lsbByte = start >> 3;

            const msbByte = lsbByte - ((lsbBit + length - 1) >> 3);
            for (let index = msbByte; index < lsbByte + 1; index++) {
                merge += data[index] << ((lsbByte - index) << 3);
            }

            value = merge >> lsbBit;
            value = value & ((1 << length) - 1);

            return value;
        }

        const configs = this.DefinitionConfigs.filter(config => config.Type == this.DataType.value);
        for (const config of configs) {
            const start = Number.parseInt(config.StartIndex);
            const length = Number.parseInt(config.Length);
            const resolution = Number.parseFloat(config.Resolution);
            const min = Number.parseFloat(config.Min)

            // const value = ResolveSingalValue(start, length, data.Data) * resolution;
            const value = ResolveSingalValue(start, length, data.Data) * resolution + min;

            config.Reference = Number.parseFloat(value.toFixed(2)).toString();
        }
    }

    /**
     * 当前协议类型发生变化时
     * @param value 模块
     */
    private async OnTypeChangedAsync(value: number, previous: number): Promise<void> {
        this.Datas.clear();

        const request = new ClientMessage.MillimeterWaveRadarProtocolDataFilterUpdateRequest(MMWRSettings.Default.DeviceIndex, value);
        await WebSocketComponent.Default.PostMessageAsync(request);

        if (this.DataSource.value == 'Simulate') {
            this.OnDataSourceChangedToSimulation();
        }
    }

    /**
     * 计算当前二进制Bit
     * @param index 配置索引
     */
    public CalculateBit(index: number): number {
        return index < this.DataBits.value.length ? this.DataBits.value[index] : 0;
    }

    public Convert(input: string, fromRadix: number, toRadix: number): string {
        return input == '' ? '' : Number.parseInt(input, fromRadix).toString(toRadix);
    }
}


/**
 *  应用组件
 */
export class UsageComponent {
    private static instance: UsageComponent = new UsageComponent();
    /**
     * 应用组件
     */
    public static get Default(): UsageComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.RecognitionMode, this.OnRecognitionModeChangedAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    /**
     * 目标识别 true:真实模型 false:Box
     */
    public RecognitionMode: Ref<boolean> = ref(false);

    private watchStopHandles: Array<WatchStopHandle> = [];

    private hasInitialized: boolean = false;
    private usageNode: number = 0;
    private instanceId: number = 0;

    private volume: number = 0;
    private effect: number = 0;

    public async Awake(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        WebWindowComponent.Default.SetTransparentBackground();
        TooltipComponent.Default.Clear();

        this.volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        this.effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(this.volume);

        if (!this.hasInitialized) {
            await this.LoadAsync();

            this.hasInitialized = true;
        }

        await OrbitCameraComponent.Default.ChangeTargetAsync(0);

        await UsageCameraComponent.Default.UpdateAsync(this.instanceId, 0.5, 1, 0.5, 300);

        await GameObjectComponent.Default.ShowAsync(this.usageNode);

        await PostProcessLayerComponent.Default.RemoveEffectAsync(this.volume, this.effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(this.volume);

        lock.Dispose();
    }

    public async Destroy(): Promise<void> {
        const lock = await MMWRComponent.Default.WaitAsync();

        await GameObjectComponent.Default.HideAsync(this.usageNode);

        await UsageCameraComponent.Default.ChangeTargetAsync(0);

        lock.Dispose();

        lock.Dispose();
    }

    private async LoadAsync(): Promise<void> {
        this.instanceId = await AssetLoaderComponent.Default.LoadAsync('Assets/R00034/ICV/Product/Apply/毫米波雷达系统/毫米波雷达系统.prefab');
        this.usageNode = await GameObjectComponent.Default.FindAsync('[UsageNode]');
        await GameObjectComponent.Default.SetParentAsync(this.instanceId, this.usageNode);
    }

    /**
     * 当目标识别模式发生改变
     * @param mode 识别模式
     */
    private async OnRecognitionModeChangedAsync(mode: boolean): Promise<void> {
        await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarRecognitionModeRequest(mode));
    }

    public async OnNavigateToChildAsync(value: string): Promise<void> {
        this.volume = await PostProcessLayerComponent.Default.AddVolumeAsync();
        this.effect = await PostProcessLayerComponent.Default.AddKawaseBlurAsync(this.volume);

        await RouterComponent.Default.NavigateToChildAsync(value);
    }

    public async NavigateToPreviousAsync(): Promise<void> {
        RouterComponent.Default.NavigateToPrevious();

        await PostProcessLayerComponent.Default.RemoveEffectAsync(this.volume, this.effect);
        await PostProcessLayerComponent.Default.RemoveVolumeAsync(this.volume);
    }
}

/**
 * 基本信息组件
 */
export class BaseInformationComponent {
    private static instance: BaseInformationComponent = new BaseInformationComponent();
    /**
     * 基本信息组件
     */
    public static get Default(): BaseInformationComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
     * 设置毫米波雷达基本配置
     * @param configuration 毫米波雷达基本配置
     */
    public async UpdateAsync(configuration: ClientMessage.MillimeterWaveRadarBaseConfiguration): Promise<void> {
        UsageComponent.Default.NavigateToPreviousAsync()
        const deviceId = MMWRSettings.Default.DeviceIndex;
        configuration.MaxDistance /= 2;
        configuration.MaxDistance |= 0;
        await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarBaseConfigurationUpdateRequest(deviceId, configuration));
    }

    /**
     * 重置毫米波雷达基本配置
     */
    public async ResetAsync(): Promise<void> {
        const deviceId = MMWRSettings.Default.DeviceIndex;
        const configuration = new ClientMessage.MillimeterWaveRadarBaseConfiguration(
            true, true, true, true, true, true, true, true, true, true,
            true, 0, 1, 200 / 2, 0, false, false, false, 0, false
        );
        await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarBaseConfigurationUpdateRequest(deviceId, configuration));
    }
}

/**
 * 物体信息组件
 */
export class ObjectInformationComponent {
    private static instance: ObjectInformationComponent = new ObjectInformationComponent();
    /**
     * 物体信息组件
     */
    public static get Default(): ObjectInformationComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));

        this.watchStopHandles.push(watch(this.Visibility, this.UpdateVisibilityAsync.bind(this)));
        this.watchStopHandles.push(watch(this.VisibleFields, this.UpdateVisibleFieldsAsync.bind(this)));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        this.watchStopHandles.clear();
    }

    /**
     * 可见性
     */
    public Visibility: Ref<boolean> = ref(false);

    /**
     * 可见字段
     */
    public VisibleFields: Ref<Array<string>> = ref([]);

    /**
     * Vue Watches
     */
    private watchStopHandles: Array<WatchStopHandle> = new Array<WatchStopHandle>();

    /**
     * 更新可见性
     * @param visibility 可见性
     * @returns 操作是否成功
     */
    private async UpdateVisibilityAsync(visibility: boolean): Promise<boolean> {
        const response = await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarObjectInformationVisibilityUpdateRequest(visibility));
        return response.Error == 0;
    }

    /**
     * 更新可见字段
     * @param fields 可见字段
     * @returns 操作是否成功
     */
    private async UpdateVisibleFieldsAsync(fields: Array<string>): Promise<boolean> {
        const response = await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.MillimeterWaveRadarObjectInformationVisibleFieldsUpdateRequest(fields));
        return response.Error == 0;
    }
}

/**
 * 过滤器配置
 */
class FilterConfig {
    Id: number;
    Name: string;
    Active: boolean = false;
    State: string;
    Min: string;
    Max: string;
    Offset: number;
    Step: string;
    Precision: string;
    Range: Array<string>;
    Options: Array<string>;

    constructor(id: number, name: string, active: boolean = false, state: string = '', min: string = '', max: string = '', offset: number = 0, step: string = '', precision: string = '1', range: Array<string> = [], options: Array<string> = []) {
        this.Id = id;
        this.Name = name;
        this.Active = active;
        this.State = state;
        this.Min = min;
        this.Max = max;
        this.Offset = offset;
        this.Step = step;
        this.Precision = precision;
        this.Range = range;
        this.Options = options;
    }
}

/**
 * 毫米波雷达过滤器组件
 */
export class FilterComponent {
    private static instance: FilterComponent = new FilterComponent();
    /**
     * 毫米波雷达过滤器组件
     */
    public static get Default(): FilterComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
     * 所有过滤器默认配置
     */
    public AllDefinition: Array<FilterConfig> = [
        new FilterConfig(0x0, '输出目标数量(个)', false, '', '0', '100', 0, '1', '1', ['0', '250']),
        new FilterConfig(0x1, '径向距离(m)', false, '', '0.0', '100.0', 0, '0.1', '0.1', ['0.0', '409.5']),
        new FilterConfig(0x2, '水平角度(°)', false, '', '-50.00', '50.00', 50, '0.05', '0.025', ['-50.00', '52.37']),
        new FilterConfig(0x3, '径向来向速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['-50.00', '128.99']),
        new FilterConfig(0x4, '径向去向速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['-50.00', '128.99']),
        new FilterConfig(0x5, '雷达反射截面积去向速度(m/s)', false, '', '-10.00', '10.00', 50, '0.05', '0.025', ['-50.00', '52.37']),
        new FilterConfig(0x6, '目标持续时间(s)', false, '', '0.0', '20.0', 0, '0.1', '0.1', ['0.0', '409.5']),
        new FilterConfig(0x7, '目标大小(m2)', false, '', '0.00', '20.00', 0, '0.05', '0.025', ['0.00', '102.37']),
        new FilterConfig(0x8, '存在可能性(%)', false, '', '0: 0%', '7: 100%', 0, '', '1', [], ['0: 0%', '1: 25%', '2: 50%', '3: 75%', '4: 90%', '5: 99%', '6: 99.9%', '7: 100%']),
        new FilterConfig(0x9, 'Y方向距离(m)', false, '', '-100.0', '100.0', 409.5, '0.1', '0.2', ['-409.5', '409.5']),
        new FilterConfig(0xA, 'X方向距离(m)', false, '', '0', '100', 500, '0.2', '0.2', ['-500', '1138.2']),
        new FilterConfig(0xB, '从右向左分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
        new FilterConfig(0xC, '从左向右分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
        new FilterConfig(0xD, '来向分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
        new FilterConfig(0xE, '去向分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
    ];

    /**
     * 所有过滤器配置
     */
    public AllConfiguration: UnwrapNestedRefs<Array<FilterConfig>> = reactive([
        new FilterConfig(0x0, '输出目标数量(个)', false, '', '0', '100', 0, '1', '1', ['0', '250']),
        new FilterConfig(0x1, '径向距离(m)', false, '', '0.0', '100.0', 0, '0.1', '0.1', ['0.0', '409.5']),
        new FilterConfig(0x2, '水平角度(°)', false, '', '-50.00', '50.00', 50, '0.05', '0.025', ['-50.00', '52.37']),
        new FilterConfig(0x3, '径向来向速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['-50.00', '128.99']),
        new FilterConfig(0x4, '径向去向速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['-50.00', '128.99']),
        new FilterConfig(0x5, '雷达反射截面积去向速度(m/s)', false, '', '-10.00', '10.00', 50, '0.05', '0.025', ['-50.00', '52.37']),
        new FilterConfig(0x6, '目标持续时间(s)', false, '', '0.0', '20.0', 0, '0.1', '0.1', ['0.0', '409.5']),
        new FilterConfig(0x7, '目标大小(m2)', false, '', '0.00', '20.00', 0, '0.05', '0.025', ['0.00', '102.37']),
        new FilterConfig(0x8, '存在可能性(%)', false, '', '0: 0%', '7: 100%', 0, '', '1', [], ['0: 0%', '1: 25%', '2: 50%', '3: 75%', '4: 90%', '5: 99%', '6: 99.9%', '7: 100%']),
        new FilterConfig(0x9, 'Y方向距离(m)', false, '', '-100.0', '100.0', 409.5, '0.1', '0.2', ['-409.5', '409.5']),
        new FilterConfig(0xA, 'X方向距离(m)', false, '', '0', '100', 500, '0.2', '0.2', ['-500', '1138.2']),
        new FilterConfig(0xB, '从右向左分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
        new FilterConfig(0xC, '从左向右分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
        new FilterConfig(0xD, '来向分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
        new FilterConfig(0xE, '去向分速度(m/s)', false, '', '0.00', '20.00', 0, '0.05', '0.0315', ['0.00', '128.99']),
    ]);

    /**
     * 所有过滤器信息
     */
    public AllInformation: UnwrapNestedRefs<Array<FilterConfig>> = reactive([
        new FilterConfig(0x0, '输出目标数量(个)', false, '', '', ''),
        new FilterConfig(0x1, '径向距离(m)', false, '', '', ''),
        new FilterConfig(0x2, '水平角度(°)', false, '', '', ''),
        new FilterConfig(0x3, '径向来向速度(m/s)', false, '', '', ''),
        new FilterConfig(0x4, '径向去向速度(m/s)', false, '', '', ''),
        new FilterConfig(0x5, '雷达反射截面积去向速度(m/s)', false, '', '', ''),
        new FilterConfig(0x6, '目标持续时间(s)', false, '', '', ''),
        new FilterConfig(0x7, '目标大小(m2)', false, '', '', ''),
        new FilterConfig(0x8, '存在可能性(%)', false, '', '', ''),
        new FilterConfig(0x9, 'Y方向距离(m)', false, '', '', ''),
        new FilterConfig(0xA, 'X方向距离(m)', false, '', '', ''),
        new FilterConfig(0xB, '从右向左分速度(m/s)', false, '', '', ''),
        new FilterConfig(0xC, '从左向右分速度(m/s)', false, '', '', ''),
        new FilterConfig(0xD, '来向分速度(m/s)', false, '', '', ''),
        new FilterConfig(0xE, '去向分速度(m/s)', false, '', '', ''),
    ]);

    /**
     * 设置过滤器
     * @param id 过滤器Id
     * @returns 设置是否成功
     */
    public async SetFilterAsync(id: number): Promise<boolean> {
        const configuration = this.AllConfiguration.find(configuration => configuration.Id == id)!;
        const deviceId = MMWRSettings.Default.DeviceIndex;
        const type = MMWRSettings.Default.BaseInformation.OutputTypeCfg == 'Objects';
        const min = Number.parseInt(`${(Number.parseFloat(configuration.Min) + configuration.Offset) * 10000 / (Number.parseFloat(configuration.Precision) * 10000)}`);
        const max = Number.parseInt(`${(Number.parseFloat(configuration.Max) + configuration.Offset) * 10000 / (Number.parseFloat(configuration.Precision) * 10000)}`);
        const request = new ClientMessage.MillimeterWaveRadarFilterConfigurationUpdateRequest(deviceId,
            [new ClientMessage.MillimeterWaveRadarFilterConfiguration(true, configuration.Active, type, id, min, max)]);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }

    /**
     * 查询所有过滤器信息
     * @returns 操作是否成功
     */
    public async QueryAsync(): Promise<boolean> {
        const deviceId = MMWRSettings.Default.DeviceIndex;
        const request = new ClientMessage.MillimeterWaveRadarFilterConfigurationUpdateRequest(deviceId,
            this.AllDefinition.map(definition => this.ComputeFilterConfiguration(definition)));
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }

    /**
     * 计算过滤器对应的默认设置
     * @param definition 过滤器定义
     * @returns 
     */
    private ComputeFilterConfiguration(definition: FilterConfig): ClientMessage.MillimeterWaveRadarFilterConfiguration {
        const type = MMWRSettings.Default.BaseInformation.OutputTypeCfg == 'Objects';
        const min = Number.parseInt(`${(Number.parseFloat(definition.Min) + definition.Offset) * 10000 / (Number.parseFloat(definition.Precision) * 10000)}`);
        const max = Number.parseInt(`${(Number.parseFloat(definition.Max) + definition.Offset) * 10000 / (Number.parseFloat(definition.Precision) * 10000)}`);
        return new ClientMessage.MillimeterWaveRadarFilterConfiguration(true, true, type, definition.Id, min, max);
    }

    /**
     * 更新所有过滤器信息
     * @param informations 过滤器信息
     */
    public UpdateInformations(informations: Array<ClientMessage.MillimeterWaveRadarFilterInformation>): void {
        for (const information of informations) {
            this.UpdateFilterInformation(information);
        }
    }

    /**
     * 更新对应的过滤器信息
     * @param input 过滤器信息
     */
    private UpdateFilterInformation(input: ClientMessage.MillimeterWaveRadarFilterInformation): void {
        const information = this.AllInformation.find(information => information.Id == input.Index)!;
        information.State = input.Active;
        information.Min = input.Min;
        information.Max = input.Max;
    }
}

/**
 * 碰撞检测组件
 */
export class CollisionComponent {
    private static instance: CollisionComponent = new CollisionComponent();
    /**
     * 碰撞检测组件
     */
    public static get Default(): CollisionComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
     * 设置毫米波雷达碰撞检测配置
     * @param resetWarning 报警信息重置
     * @param activation 是否使能配置
     * @param clearRegions 清除所有区域
     * @param minTimeValid 最短时间是否生效
     * @param minTime 最短时间
     * @returns 
     */
    public async SetCollisionAsync(resetWarning: boolean, activation: boolean, clearRegions: boolean, minTimeValid: boolean, minTime: number): Promise<boolean> {
        const deviceId = MMWRSettings.Default.DeviceIndex;

        minTime *= 10;
        minTime |= 0;

        const configuration = new ClientMessage.MillimeterWaveRadarCollisionConfiguration(resetWarning, activation, clearRegions, minTimeValid, minTime);
        const request = new ClientMessage.MillimeterWaveRadarCollisionConfigurationUpdateRequest(deviceId, configuration);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        UsageComponent.Default.NavigateToPreviousAsync()
        return response.Error == 0;
        
    }

    /**
     * 设置碰撞检测区域配置
     * @param activation 是否使能配置
     * @param coordinatesValid 坐标是否有效
     * @param regionID 区域Id
     * @param point1X P1 X坐标
     * @param point1Y P1 Y坐标
     * @param point2X P2 X坐标
     * @param point2Y P2 Y坐标
     * @returns 
     */
    public async SetCollisionRegionAsync(activation: boolean, coordinatesValid: boolean, regionID: number, point1X: string, point1Y: string, point2X: string, point2Y: string): Promise<boolean> {
        UsageComponent.Default.NavigateToPreviousAsync()
        const deviceId = MMWRSettings.Default.DeviceIndex;

        point1X = `${((Number.parseFloat(point1X) + 500) / 0.2) | 0}`;
        point1Y = `${((Number.parseFloat(point1Y) + 204.6) / 0.2) | 0}`;
        point2X = `${((Number.parseFloat(point2X) + 500) / 0.2) | 0}`;
        point2Y = `${((Number.parseFloat(point2Y) + 204.6) / 0.2) | 0}`;

        const configuration = new ClientMessage.MillimeterWaveRadarCollisionRegionConfiguration(activation, coordinatesValid, regionID, point1X, point1Y, point2X, point2Y);
        const request = new ClientMessage.MillimeterWaveRadarCollisionRegionConfigurationUpdateRequest(deviceId, configuration);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }
}

/**
 * 车速组件
 */
export class SpeedComponent {
    private static instance: SpeedComponent = new SpeedComponent();
    /**
     * 车速组件
     */
    public static get Default(): SpeedComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
     * 设置速度
     * @param direction 方向
     * @param speed 速度
     * @returns 
     */
    public async SetSpeedAsync(direction: number, speed: number): Promise<boolean> {
        const deviceId = MMWRSettings.Default.DeviceIndex;

        speed *= 50;
        speed |= 0;

        const configuration = new ClientMessage.MillimeterWaveRadarSpeedConfiguration(direction, speed);
        const request = new ClientMessage.MillimeterWaveRadarSpeedUpdateRequest(deviceId, configuration);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }
}

/**
 * 横摆角速度组件
 */
export class RateComponent {
    private static instance: RateComponent = new RateComponent();
    /**
     * 横摆角速度组件
     */
    public static get Default(): RateComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
    * 设置速度
    * @param speed 速度
    * @returns 
    */
    public async SetRateAsync(speed: number): Promise<boolean> {
        const deviceId = MMWRSettings.Default.DeviceIndex;

        speed = (speed + + 327.68) * 100;
        speed |= 0;

        const configuration = new ClientMessage.MillimeterWaveRadarRateConfiguration(speed);
        const request = new ClientMessage.MillimeterWaveRadarRateUpdateRequest(deviceId, configuration);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }
}

/**
 * 碰撞区域可见性组件
 */
export class CollisionRegionVisibilityComponent {
    private static instance: CollisionRegionVisibilityComponent = new CollisionRegionVisibilityComponent();
    /**
     * 碰撞区域可见性组件
     */
    public static get Default(): CollisionRegionVisibilityComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
    * 更新可见性
    * @param state 可见性
    * @returns 
    */
    public async UpdateAsync(state: boolean): Promise<boolean> {
        const deviceId = MMWRSettings.Default.DeviceIndex;
        const request = new ClientMessage.MillimeterWaveRadarCollisionRegionVisibilityUpdateRequest(deviceId, state);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }
}

/**
 * 检测区域可见性组件
 */
export class DetectionAreaVisibilityComponent {
    private static instance: DetectionAreaVisibilityComponent = new DetectionAreaVisibilityComponent();
    /**
     * 检测区域可见性组件
     */
    public static get Default(): DetectionAreaVisibilityComponent {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);
    }

    /**
    * 更新可见性
    * @param state 可见性
    * @returns 
    */
    public async UpdateAsync(state: boolean): Promise<boolean> {
        const deviceId = MMWRSettings.Default.DeviceIndex;
        const request = new ClientMessage.MillimeterWaveRadarDetectionAreaVisibilityUpdateRequest(deviceId, state);
        const response = await WebSocketComponent.Default.PostMessageAsync(request);
        return response.Error == 0;
    }
}